IFeed feed = new Feed(new URL("inmemory://rss_2_0.xml")); //$NON-NLS-1$
feed = NewsModel.getDefault().getPersistenceLayer().getModelDAO().saveFeed(feed);
assertEquals(0, getUnreadCount(feed));
assertEquals(0, getNewCount(feed));
FeedReference feedRef = new FeedReference(feed.getId());
IBookMark bookmark = createBookMark(feed);
IPreferencesScope preferences = NewsModel.getDefault().getEntityScope(bookmark);
preferences.putInteger(DefaultPreferences.DEL_NEWS_BY_COUNT_VALUE, 0);
preferences.putBoolean(DefaultPreferences.DEL_NEWS_BY_COUNT_STATE, true);
/* First Reload */
InMemoryProtocolHandler.FEED = generateFeed("Title", "http://www.link.de", null, null);
fController.reload(bookmark, null, new NullProgressMonitor());
assertEquals(1, feedRef.resolve().getNews().size());
assertEquals(1, getUnreadCount(feed));
assertEquals(1, getNewCount(feed));
/* Set to UNREAD */
fApplicationLayer.setNewsState(feedRef.resolve().getNews(), INews.State.UNREAD, true, false);
assertEquals(0, getNewCount(feed));
/* Second Reload */
fController.reload(bookmark, null, new NullProgressMonitor());
assertEquals(0, getUnreadCount(feed));
assertEquals(0, getNewCount(feed));
/* Third Reload */
InMemoryProtocolHandler.FEED = generateEmptyFeed();
fController.reload(bookmark, null, new NullProgressMonitor());
assertEquals(0, feedRef.resolve().getNews().size());
}