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