BookmarksPresenter extends BasePresenter<BookmarksView> { @Override public void onViewCreated() { if (changeListener == null) { throw new IllegalStateException("OnBookmarksChangeListener is not specified"); } updateBookmarks(null); } @Inject  BookmarksPresenter(BookmarksManager bookmarksManager, Librarian myLibrarian); @Override void onViewCreated();  }
@Test(expected = IllegalStateException.class) public void onViewCreatedWithoutChangeListener() throws Exception { presenter.onViewCreated(); }
@Test public void onViewCreated() throws Exception { presenter.setChangeListener(changeListener); presenter.onViewCreated(); verify(bookmarksManager).getAll(isNull()); verify(view).updateBookmarks(bmCaptor.capture()); List<Bookmark> bookmarksRes = bmCaptor.getValue(); assertNotNull(bookmarksRes); assertThat(bookmarksRes.size(), equalTo(bookmarksWithoutTag.size())); }