use of com.newsrob.Entry in project newsrob by marianokamp.
the class DifferentialUpdateTests method testDifferentialUpdateRead2.
/** Is the pinned state preserved */
public void testDifferentialUpdateRead2() throws Exception {
createTestDataSet1();
// One pinned, one unread, one read
assertEquals(3, entryManager.getArticleCount());
assertEquals(2, entryManager.getUnreadArticleCount());
assertEquals(1, entryManager.getUnreadArticleCountExcludingPinned());
// do
final EntriesRetriever entriesRetriever = getEntriesRetriever(new String[] { getAtomIdForArticle(3) });
// First article should still be read,
// 2nd article should now be read,
// 3rd article should still be unread and pinned.
entriesRetriever.differentialUpdateOfArticlesStates(entryManager, TestUtil.getDummyJob(entryManager), EntriesRetriever.GOOGLE_STATE_READING_LIST, EntriesRetriever.GOOGLE_STATE_READ, ArticleDbState.READ);
// Unchanged
assertEquals(3, entryManager.getArticleCount());
assertEquals(1, entryManager.getUnreadArticleCount());
assertEquals(0, entryManager.getUnreadArticleCountExcludingPinned());
Entry firstArticle = entryManager.findEntryByAtomId(getAtomIdForArticle(1));
assertEquals(ReadState.READ, firstArticle.getReadState());
assertFalse(firstArticle.isReadStatePending());
Entry secondArticle = entryManager.findEntryByAtomId(getAtomIdForArticle(2));
assertEquals(ReadState.READ, secondArticle.getReadState());
assertFalse(secondArticle.isReadStatePending());
Entry thirdArticle = entryManager.findEntryByAtomId(getAtomIdForArticle(3));
assertEquals(ReadState.PINNED, thirdArticle.getReadState());
assertFalse(thirdArticle.isReadStatePending());
}
use of com.newsrob.Entry in project newsrob by marianokamp.
the class PinTests method testMarkAllReadDoesntMarkPinnedArticlesRead.
public void testMarkAllReadDoesntMarkPinnedArticlesRead() throws InterruptedException {
TestUtil.populateDatabaseWithDataSet1(entryManager);
Entry article = entryManager.findEntryByAtomId("atomid5");
entryManager.increaseUnreadLevel(article);
article = entryManager.findEntryByAtomId("atomid5");
assertEquals(ReadState.PINNED, article.getReadState());
DBQuery dbq = new DBQuery(entryManager, null, null);
executeMarkAllRead(dbq);
assertEquals(1, entryManager.getUnreadArticleCount());
}
use of com.newsrob.Entry in project newsrob by marianokamp.
the class PinTests method testIncreaseReadLevelFromUnread.
public void testIncreaseReadLevelFromUnread() {
Entry article = createArticleWithReadState(ReadState.UNREAD);
entryManager.increaseReadLevel(article);
assertEquals(ReadState.READ, article.getReadState());
assertTrue(article.isReadStatePending());
// no change when increasing the read level again
entryManager.increaseReadLevel(article);
assertEquals(ReadState.READ, article.getReadState());
assertTrue(article.isReadStatePending());
}
use of com.newsrob.Entry in project newsrob by marianokamp.
the class PinTests method testIncreaseUnreadLevelFromPinned.
public void testIncreaseUnreadLevelFromPinned() {
Entry article = createArticleWithReadState(ReadState.PINNED);
entryManager.increaseUnreadLevel(article);
assertEquals(ReadState.PINNED, article.getReadState());
assertFalse(article.isReadStatePending());
}
use of com.newsrob.Entry in project newsrob by marianokamp.
the class PinTests method testIncreaseUnreadLevelFromRead.
public void testIncreaseUnreadLevelFromRead() {
Entry article = createArticleWithReadState(ReadState.READ);
entryManager.increaseUnreadLevel(article);
assertEquals(ReadState.UNREAD, article.getReadState());
assertTrue(article.isReadStatePending());
entryManager.increaseUnreadLevel(article);
assertEquals(ReadState.PINNED, article.getReadState());
assertTrue(article.isReadStatePending());
entryManager.increaseUnreadLevel(article);
assertEquals(ReadState.PINNED, article.getReadState());
assertTrue(article.isReadStatePending());
}
Aggregations