예제 #1
0
  @Test
  public void oauthCallback_onSuccessCallsView() {
    when(oAuthInteractor.retrieveAccessToken(any(Uri.class))).thenReturn(Completable.complete());

    Uri uri = mock(Uri.class);
    presenter.oauthCallback(uri);

    verify(loginView, times(1)).onAuthSuccess();
    verify(loginView, times(1)).showLoading();
    verifyNoMoreInteractions(loginView);
  }
예제 #2
0
  @Test
  public void oauthCallback_onErrorCallsView() {
    when(oAuthInteractor.retrieveAccessToken(any(Uri.class)))
        .thenReturn(Completable.error(new Throwable("Error~")));

    Uri uri = mock(Uri.class);
    presenter.oauthCallback(uri);

    verify(loginView, times(1)).onErrorAccessToken();
    verify(loginView, times(1)).showLoading();
    verifyNoMoreInteractions(loginView);
  }