CakePresenter extends BasePresenter<MainView> implements Observer<CakesResponse> { @Override public void onNext(CakesResponse cakesResponse) { List<Cake> cakes = mCakeMapper.mapCakes(mStorage, cakesResponse); getView().onClearItems(); getView().onCakeLoaded(cakes); } @Inject  CakePresenter(); void getCakes(); @Override void onCompleted(); @Override void onError(Throwable e); @Override void onNext(CakesResponse cakesResponse); void getCakesFromDatabase();  }
@Test public void onNext() throws Exception { CakesResponse response = mock(CakesResponse.class); CakesResponseCakes[] responseCakes = new CakesResponseCakes[1]; when(response.getCakes()).thenReturn(responseCakes); presenter.onNext(response); verify(mCakeMapper, times(1)).mapCakes(mStorage, response); verify(mView, times(1)).onClearItems(); verify(mView, times(1)).onCakeLoaded(anyList()); }