LoadSentenceUC extends AbstractUseCase<Long, Sentence, Void> { private void loadSentence() { LogUtils.v(Constants.TAG, "start to load sentence[" + getRequestValue() + "]"); Sentence sentence = mSentenceRepository.getSentence(getRequestValue()); if (getUseCaseCallback() != null) { getUseCaseCallback().onSuccess(sentence); } } LoadSentenceUC(SentenceRepository sentenceDataRepository); @Override void run();  }
@Test public void testLoadSentence() { final Sentence newSentence = new SentenceEntity(); newSentence.setDateline("2016-08-16"); newSentence.setId(123L); when(mSentenceRepository.getSentence(123L)).thenReturn(newSentence); mLoadSentenceUC.setRequestValue(123L); mLoadSentenceUC.setUseCaseCallback(new LoadSentenceUC.LoadSentenceCallback() { @Override public void onSentenceGot(Sentence sentence) { assertThat(sentence, is(newSentence)); } }); mLoadSentenceUC.run(); verify(mSentenceRepository).getSentence(123L); }