ReaderViewPresenter extends BasePresenter<ReaderView> implements TTSPlayerFragment.OnTTSStopSpeakListener { void nextChapter() { try { librarian.nextChapter(); viewCurrentChapter(); } catch (OpenModuleException e) { getView().onOpenChapterFailure(e); } } @Inject  ReaderViewPresenter(Librarian librarian, PreferenceHelper prefHelper, AnalyticsHelper helper); @Override void onStopSpeak(); @Override void onViewCreated();  }
@Test public void nextChapter() throws Exception { when(librarian.isOSISLinkValid(any())).thenReturn(false); presenter.nextChapter(); verify(librarian).getCurrentOSISLink(); verify(view).disableActionMode(); verify(view).openLibraryActivity(); }
@Test public void nextChapterWithError() throws Exception { doAnswer(invocation -> { throw new OpenModuleException("RST", ""); }).when(librarian).nextChapter(); presenter.nextChapter(); verify(view).onOpenChapterFailure(any()); }