@Test public void signOut_fail() { Auth auth = new Auth(); BiConsumer biConsumer = Mockito.mock(BiConsumer.class); Mockito.doThrow(new RuntimeException()).when(firebaseAuth).signOut(); auth.signOut().fail(biConsumer); PowerMockito.verifyStatic(FirebaseAuth.class, VerificationModeFactory.times(1)); FirebaseAuth.getInstance(); Mockito.verify(firebaseAuth, VerificationModeFactory.times(1)).signOut(); Mockito.verify(biConsumer, VerificationModeFactory.times(1)).accept(Mockito.nullable(String.class), Mockito.any(Exception.class)); }
@Override public Promise<Void> signOut() { return FuturePromise.when(new Consumer<FuturePromise<Void>>() { @Override public void accept(FuturePromise<Void> promise) { try { FirebaseAuth.getInstance().signOut(); promise.doComplete(null); } catch (Exception e) { promise.doFail(e); } } }); }
Auth implements AuthDistribution { @Override public Promise<Void> signOut() { return FuturePromise.when(new Consumer<FuturePromise<Void>>() { @Override public void accept(FuturePromise<Void> promise) { try { FirebaseAuth.getInstance().signOut(); promise.doComplete(null); } catch (Exception e) { promise.doFail(e); } } }); } }
Auth implements AuthDistribution { @Override public Promise<Void> signOut() { return FuturePromise.when(new Consumer<FuturePromise<Void>>() { @Override public void accept(FuturePromise<Void> promise) { try { FirebaseAuth.getInstance().signOut(); promise.doComplete(null); } catch (Exception e) { promise.doFail(e); } } }); }  }
Auth implements AuthDistribution { @Override public Promise<Void> signOut() { return FuturePromise.when(new Consumer<FuturePromise<Void>>() { @Override public void accept(FuturePromise<Void> promise) { try { FirebaseAuth.getInstance().signOut(); promise.doComplete(null); } catch (Exception e) { promise.doFail(e); } } }); }  @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<Void> signOut() { return FuturePromise.when(new Consumer<FuturePromise<Void>>() { @Override public void accept(FuturePromise<Void> promise) { try { FirebaseAuth.getInstance().signOut(); promise.doComplete(null); } catch (Exception e) { promise.doFail(e); } } }); }  @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);  }