@Test public void sendEmailVerification_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.sendEmailVerification()).thenReturn(task); user.sendEmailVerification().fail(consumer); Mockito.verify(firebaseUser, VerificationModeFactory.times(1)).sendEmailVerification(); Mockito.verify(consumer, VerificationModeFactory.times(1)).accept(Mockito.nullable(String.class), Mockito.nullable(Exception.class)); }
@Override public Promise<GdxFirebaseUser> sendEmailVerification() { if (FirebaseAuth.getInstance().getCurrentUser() == null) { throw new IllegalStateException(); } return FuturePromise.when(new AuthPromiseConsumer<>(FirebaseAuth.getInstance().getCurrentUser() .sendEmailVerification())); }
User implements AuthUserDistribution { @Override public Promise<GdxFirebaseUser> sendEmailVerification() { if (FirebaseAuth.getInstance().getCurrentUser() == null) { throw new IllegalStateException(); } return FuturePromise.when(new AuthPromiseConsumer<>(FirebaseAuth.getInstance().getCurrentUser() .sendEmailVerification())); } }
User implements AuthUserDistribution { @Override public Promise<GdxFirebaseUser> sendEmailVerification() { if (FirebaseAuth.getInstance().getCurrentUser() == null) { throw new IllegalStateException(); } return FuturePromise.when(new AuthPromiseConsumer<>(FirebaseAuth.getInstance().getCurrentUser() .sendEmailVerification())); }  }
User implements AuthUserDistribution { @Override public Promise<GdxFirebaseUser> sendEmailVerification() { if (FirebaseAuth.getInstance().getCurrentUser() == null) { throw new IllegalStateException(); } return FuturePromise.when(new AuthPromiseConsumer<>(FirebaseAuth.getInstance().getCurrentUser() .sendEmailVerification())); }  @Override Promise<GdxFirebaseUser> updateEmail(String newEmail); @Override Promise<GdxFirebaseUser> sendEmailVerification(); @Override Promise<GdxFirebaseUser> updatePassword(char[] newPassword); @Override Promise<Void> delete(); @Override Promise<GdxFirebaseUser> reload(); }
User implements AuthUserDistribution { @Override public Promise<GdxFirebaseUser> sendEmailVerification() { if (FirebaseAuth.getInstance().getCurrentUser() == null) { throw new IllegalStateException(); } return FuturePromise.when(new AuthPromiseConsumer<>(FirebaseAuth.getInstance().getCurrentUser() .sendEmailVerification())); }  @Override Promise<GdxFirebaseUser> updateEmail(String newEmail); @Override Promise<GdxFirebaseUser> sendEmailVerification(); @Override Promise<GdxFirebaseUser> updatePassword(char[] newPassword); @Override Promise<Void> delete(); @Override Promise<GdxFirebaseUser> reload();  }