@Test public void onComplete_withoutError() { DatabaseError databaseError = null; DatabaseReference databaseReference = Mockito.mock(DatabaseReference.class); FuturePromise promise = Mockito.spy(FuturePromise.class); QueryCompletionListener listener = new QueryCompletionListener(promise); listener.onComplete(databaseError, databaseReference); Mockito.verify(promise, VerificationModeFactory.times(1)).doComplete(Mockito.any()); }
@Override public void onComplete(DatabaseError databaseError, DatabaseReference databaseReference) { if (promise == null) return; if (databaseError != null) { promise.doFail(databaseError.toException()); } else { promise.doComplete(null); } }
QueryCompletionListener implements DatabaseReference.CompletionListener { @Override public void onComplete(DatabaseError databaseError, DatabaseReference databaseReference) { if (promise == null) return; if (databaseError != null) { promise.doFail(databaseError.toException()); } else { promise.doComplete(null); } } }
QueryCompletionListener implements DatabaseReference.CompletionListener { @Override public void onComplete(DatabaseError databaseError, DatabaseReference databaseReference) { if (promise == null) return; if (databaseError != null) { promise.doFail(databaseError.toException()); } else { promise.doComplete(null); } } QueryCompletionListener(FuturePromise promise); }
QueryCompletionListener implements DatabaseReference.CompletionListener { @Override public void onComplete(DatabaseError databaseError, DatabaseReference databaseReference) { if (promise == null) return; if (databaseError != null) { promise.doFail(databaseError.toException()); } else { promise.doComplete(null); } } QueryCompletionListener(FuturePromise promise); @Override void onComplete(DatabaseError databaseError, DatabaseReference databaseReference); }
QueryCompletionListener implements DatabaseReference.CompletionListener { @Override public void onComplete(DatabaseError databaseError, DatabaseReference databaseReference) { if (promise == null) return; if (databaseError != null) { promise.doFail(databaseError.toException()); } else { promise.doComplete(null); } } QueryCompletionListener(FuturePromise promise); @Override void onComplete(DatabaseError databaseError, DatabaseReference databaseReference);  }