BookmarksPresenter extends BasePresenter<BookmarksView> { void onClickBookmarkOpen(int position) { if (position >= bookmarks.size()) { return; } Bookmark bookmark = bookmarks.get(position); BibleReference osisLink = new BibleReference(bookmark.OSISLink); if (!myLibrarian.isOSISLinkValid(osisLink)) { StaticLogger.info(this, "Delete invalid bookmark: " + position); getView().showToast(R.string.bookmark_invalid_removed); deleteBookmarkAndRefresh(bookmark); } else { changeListener.onBookmarksSelect(bookmark); } } @Inject  BookmarksPresenter(BookmarksManager bookmarksManager, Librarian myLibrarian); @Override void onViewCreated();  }
@Test public void onClickBookmarkOpen() throws Exception { when(librarian.isOSISLinkValid(any())).thenReturn(true); presenter.setChangeListener(changeListener); presenter.onRefresh(); presenter.onClickBookmarkOpen(0); verify(changeListener).onBookmarksSelect(eq(bookmarksWithoutTag.get(0))); }