CakePresenter extends BasePresenter<MainView> implements Observer<CakesResponse> { public void getCakes() { getView().onShowDialog("Loading cakes...."); Observable<CakesResponse> cakesResponseObservable = mApiService.getCakes(); subscribe(cakesResponseObservable, this); } @Inject  CakePresenter(); void getCakes(); @Override void onCompleted(); @Override void onError(Throwable e); @Override void onNext(CakesResponse cakesResponse); void getCakesFromDatabase();  }
@Test public void getCakes() throws Exception { PowerMockito.mockStatic(Looper.class); when(AndroidSchedulers.mainThread()).thenReturn(mRxJavaSchedulersHook.getComputationScheduler()); when(mApiService.getCakes()).thenReturn(mObservable); presenter.getCakes(); verify(mView, atLeastOnce()).onShowDialog("Loading cakes...."); }