### Question:
User implements AuthUserDistribution { @Override public Promise<GdxFirebaseUser> updatePassword(char[] newPassword) { if (FirebaseAuth.getInstance().getCurrentUser() == null) { throw new IllegalStateException(); } return FuturePromise.when(new AuthPromiseConsumer<>(FirebaseAuth.getInstance().getCurrentUser() .updatePassword(new String(newPassword)))); }  @Override Promise<GdxFirebaseUser> updateEmail(String newEmail); @Override Promise<GdxFirebaseUser> sendEmailVerification(); @Override Promise<GdxFirebaseUser> updatePassword(char[] newPassword); @Override Promise<Void> delete(); @Override Promise<GdxFirebaseUser> reload();  }### Answer:
@Test(expected = IllegalStateException.class) public void updatePassword_noUser() { User user = new User(); user.updatePassword(new char[]{'a', 'b'}); Assert.fail(); }
@Test public void updatePassword() { User user = new User(); FirebaseUser firebaseUser = Mockito.mock(FirebaseUser.class); Consumer consumer = Mockito.mock(Consumer.class); Mockito.when(firebaseAuth.getCurrentUser()).thenReturn(firebaseUser); Mockito.when(task.isSuccessful()).thenReturn(true); Mockito.when(firebaseUser.updatePassword(Mockito.anyString())).thenReturn(task); char[] arg1 = {'a', 'b', 'c'}; user.updatePassword(arg1).then(consumer); Mockito.verify(firebaseUser, VerificationModeFactory.times(1)).updatePassword(Mockito.eq(new String(arg1))); Mockito.verify(consumer, VerificationModeFactory.times(1)).accept(Mockito.any()); }
@Test public void updatePassword_fail() { User user = new User(); FirebaseUser firebaseUser = Mockito.mock(FirebaseUser.class); BiConsumer consumer = Mockito.mock(BiConsumer.class); Mockito.when(firebaseAuth.getCurrentUser()).thenReturn(firebaseUser); Mockito.when(task.isSuccessful()).thenReturn(false); Mockito.when(firebaseUser.updatePassword(Mockito.anyString())).thenReturn(task); char[] arg1 = {'a', 'b', 'c'}; user.updatePassword(arg1).fail(consumer); Mockito.verify(firebaseUser, VerificationModeFactory.times(1)).updatePassword(Mockito.eq(new String(arg1))); Mockito.verify(consumer, VerificationModeFactory.times(1)).accept(Mockito.nullable(String.class), Mockito.nullable(Exception.class)); }