### Question:
AuthPromiseConsumer implements Consumer<FuturePromise<GdxFirebaseUser>> { @Override public void accept(final FuturePromise<GdxFirebaseUser> promise) { if (task != null) { task.addOnCompleteListener(new OnCompleteListener<T>() { @Override public void onComplete(@NonNull Task<T> task) { if (task.isSuccessful()) { promise.doComplete(GdxFIRAuth.instance().getCurrentUser()); } else { promise.doFail(task.getException() != null ? task.getException().getLocalizedMessage() : "Authorization fail", task.getException()); } } }); } } AuthPromiseConsumer(Task<T> task); @Override void accept(final FuturePromise<GdxFirebaseUser> promise);  }### Answer:
@Test public void accept() { Mockito.when(task.isSuccessful()).thenReturn(true); FuturePromise promise = Mockito.spy(FuturePromise.empty()); promise.then(Mockito.mock(Consumer.class)).silentFail(); AuthPromiseConsumer authPromiseConsumer = new AuthPromiseConsumer(task); authPromiseConsumer.accept(promise); Mockito.verify(promise, VerificationModeFactory.atLeast(1)).doComplete(Mockito.any()); }
@Test public void accept_fail() { Mockito.when(task.isSuccessful()).thenReturn(false); FuturePromise promise = Mockito.spy(FuturePromise.empty()); promise.then(Mockito.mock(Consumer.class)).silentFail(); AuthPromiseConsumer authPromiseConsumer = new AuthPromiseConsumer(task); authPromiseConsumer.accept(promise); Mockito.verify(promise, VerificationModeFactory.times(1)).doFail(Mockito.nullable(String.class), Mockito.nullable(Exception.class)); }