@Test public void createUserWithEmailAndPassword_fail() { Auth auth = new Auth(); BiConsumer biConsumer = Mockito.mock(BiConsumer.class); Mockito.when(task.isSuccessful()).thenReturn(false); Mockito.when(task.getException()).thenReturn(new Exception()); Mockito.doReturn(task).when(firebaseAuth).createUserWithEmailAndPassword(Mockito.anyString(), Mockito.anyString()); auth.createUserWithEmailAndPassword("user", "password".toCharArray()) .fail(biConsumer); PowerMockito.verifyStatic(FirebaseAuth.class, VerificationModeFactory.times(1)); FirebaseAuth.getInstance(); Mockito.verify(firebaseAuth, VerificationModeFactory.times(1)).createUserWithEmailAndPassword(Mockito.eq("user"), Mockito.eq("password")); Mockito.verify(biConsumer, VerificationModeFactory.times(1)).accept(Mockito.nullable(String.class), Mockito.any(Exception.class)); }
@Override public Promise<GdxFirebaseUser> createUserWithEmailAndPassword(String email, char[] password) { return FuturePromise.when(new AuthPromiseConsumer<>(FirebaseAuth.getInstance().createUserWithEmailAndPassword(email, new String(password)))); }
Auth implements AuthDistribution { @Override public Promise<GdxFirebaseUser> createUserWithEmailAndPassword(String email, char[] password) { return FuturePromise.when(new AuthPromiseConsumer<>(FirebaseAuth.getInstance().createUserWithEmailAndPassword(email, new String(password)))); } }
Auth implements AuthDistribution { @Override public Promise<GdxFirebaseUser> createUserWithEmailAndPassword(String email, char[] password) { return FuturePromise.when(new AuthPromiseConsumer<>(FirebaseAuth.getInstance().createUserWithEmailAndPassword(email, new String(password)))); }  }
Auth implements AuthDistribution { @Override public Promise<GdxFirebaseUser> createUserWithEmailAndPassword(String email, char[] password) { return FuturePromise.when(new AuthPromiseConsumer<>(FirebaseAuth.getInstance().createUserWithEmailAndPassword(email, new String(password)))); }  @Override GdxFirebaseUser getCurrentUser(); @Override Promise<GdxFirebaseUser> createUserWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithToken(String token); @Override Promise<GdxFirebaseUser> signInAnonymously(); @Override Promise<Void> signOut(); @Override Promise<Void> sendPasswordResetEmail(final String email); }
Auth implements AuthDistribution { @Override public Promise<GdxFirebaseUser> createUserWithEmailAndPassword(String email, char[] password) { return FuturePromise.when(new AuthPromiseConsumer<>(FirebaseAuth.getInstance().createUserWithEmailAndPassword(email, new String(password)))); }  @Override GdxFirebaseUser getCurrentUser(); @Override Promise<GdxFirebaseUser> createUserWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithToken(String token); @Override Promise<GdxFirebaseUser> signInAnonymously(); @Override Promise<Void> signOut(); @Override Promise<Void> sendPasswordResetEmail(final String email);  }