Search in sources :

Example 6 with BookmarkModel

use of com.quran.labs.androidquran.model.bookmark.BookmarkModel in project quran_android by quran.

the class BookmarkPresenterTest method testBookmarkObservableMixedBookmarksByDateWithRecentPage.

@Test
public void testBookmarkObservableMixedBookmarksByDateWithRecentPage() {
    BookmarkModel model = new BookmarkModel(bookmarksAdapter, recentPageModel) {

        @Override
        public Single<BookmarkData> getBookmarkDataObservable(int sortOrder) {
            return Single.zip(Single.just(TAG_LIST), Single.just(MIXED_BOOKMARKS_LIST), Single.just(RECENTS_LIST), BookmarkData::new);
        }
    };
    when(settings.getLastPage()).thenReturn(42);
    BookmarkPresenter presenter = makeBookmarkPresenter(model);
    BookmarkResult result = getBookmarkResultByDateAndValidate(presenter, false);
    assertThat(result.getTagMap()).hasSize(2);
    // 2 for "current page", 1 for "page bookmarks" and 1 for "ayah bookmarks"
    assertThat(result.getRows()).hasSize(MIXED_BOOKMARKS_LIST.size() + 4);
}
Also used : BookmarkData(com.quran.labs.androidquran.dao.BookmarkData) BookmarkResult(com.quran.labs.androidquran.model.bookmark.BookmarkResult) BookmarkModel(com.quran.labs.androidquran.model.bookmark.BookmarkModel) Test(org.junit.Test)

Aggregations

BookmarkData (com.quran.labs.androidquran.dao.BookmarkData)6 BookmarkModel (com.quran.labs.androidquran.model.bookmark.BookmarkModel)6 BookmarkResult (com.quran.labs.androidquran.model.bookmark.BookmarkResult)6 Test (org.junit.Test)6 ArrayList (java.util.ArrayList)4 List (java.util.List)4