@Override public Iterable<Long> getUserItems(Long u) { if (model == null) { generateDatamodel(); } try { return model.getItemIDsFromUser(u); } catch (TasteException e) { e.printStackTrace(); } return Collections.emptySet(); }
@Override public Iterable<Long> getUserItemTimestamps(Long u, Long i) { if (model == null) { generateDatamodel(); } List<Long> t = new ArrayList<>(); try { t.add(model.getPreferenceTime(u, i)); } catch (TasteException e) { e.printStackTrace(); } return t; }
@Override public Double getUserItemPreference(Long u, Long i) { if (model == null) { generateDatamodel(); } try { return model.getPreferenceValue(u, i) * 1.0; } catch (TasteException e) { e.printStackTrace(); } return Double.NaN; }
@Test public void testNSUException() { // Just make sure this all doesn't, ah, throw an exception TasteException te1 = new NoSuchUserException(); TasteException te4 = new NoSuchUserException(te1.toString()); te4.printStackTrace(new PrintStream(new ByteArrayOutputStream())); te4.printStackTrace(new PrintWriter(new OutputStreamWriter(new ByteArrayOutputStream()))); }
@Test public void testNSIException() { // Just make sure this all doesn't, ah, throw an exception TasteException te1 = new NoSuchItemException(); TasteException te4 = new NoSuchItemException(te1.toString()); te4.printStackTrace(new PrintStream(new ByteArrayOutputStream())); te4.printStackTrace(new PrintWriter(new OutputStreamWriter(new ByteArrayOutputStream()))); }
@Test public void testTasteException() { // Just make sure this all doesn't, ah, throw an exception TasteException te1 = new TasteException(); TasteException te2 = new TasteException(te1); TasteException te3 = new TasteException(te2.toString(), te2); TasteException te4 = new TasteException(te3.toString()); te4.printStackTrace(new PrintStream(new ByteArrayOutputStream())); te4.printStackTrace(new PrintWriter(new OutputStreamWriter(new ByteArrayOutputStream()))); }
createFile = false; } catch (TasteException e) { e.printStackTrace();