  @Test public void testUpdateEmail_notSuccessful() {

    mockNotSuccessfulVoidResult(new IllegalStateException());
    when(mockFirebaseUser.updateEmail("foo@bar.com")).thenReturn(mockVoidTaskResult);

    TestObserver obs = TestObserver.create();

    RxFirebaseUser.updateEmail(mockFirebaseUser, "foo@bar.com").subscribe(obs);

    callOnComplete(mockVoidTaskResult);
    obs.dispose();

    // Ensure no more values are emitted after unsubscribe
    callOnComplete(mockVoidTaskResult);

    obs.assertError(IllegalStateException.class);
    obs.assertNotComplete();
  }