### Question:
DefaultNewsService implements NewsService { @Override public List<NewsData> getLatestNews() { try { return JSON.std.with(Feature.READ_ONLY, true).listOfFrom(NewsData.class, urlToStream(new URL(pdfsam.property(ConfigurableProperty.NEWS_URL)))); } catch (IOException e) { LOG.warn(DefaultI18nContext.getInstance().i18n("Unable to retrieve latest news"), e); } return Collections.emptyList(); } @Inject  DefaultNewsService(Pdfsam pdfsam); @Override List<NewsData> getLatestNews(); @Override int getLatestNewsSeen(); @Override void setLatestNewsSeen(int id); @Override int getLatestImportantNewsSeen(); @Override void setLatestImportantNewsSeen(int id); @Override void clear();  }### Answer:
@Test public void testGetLatestNews() throws Exception { File file = folder.newFile(); FileUtils.copyInputStreamToFile(getClass().getResourceAsStream("/test_news.json"), file); when(pdfsam.property(ConfigurableProperty.NEWS_URL)).thenReturn(file.toURI().toString()); List<NewsData> news = victim.getLatestNews(); assertEquals(1, news.size()); assertEquals("news-title", news.get(0).getTitle()); assertEquals("news-content", news.get(0).getContent()); assertEquals(21, news.get(0).getId()); assertEquals("http: assertNotNull(news.get(0).getDate()); assertTrue(news.get(0).isImportant()); }