OperationAccountant { private boolean onOperationCompletion() { resetNoSuccessWarningDeadline(); if (count.decrementAndGet() == 0) { synchronized (signal) { signal.notifyAll(); } } return true; } OperationAccountant(); @VisibleForTesting  OperationAccountant(NanoClock clock, long finishWaitMillis); void registerOperation(final ApiFuture<?> future); void awaitCompletion(); boolean hasInflightOperations();  }
@Test public void testOnOperationCompletion() { OperationAccountant underTest = new OperationAccountant(); SettableApiFuture<String> future = SettableApiFuture.create(); underTest.registerOperation(future); assertTrue(underTest.hasInflightOperations()); future.set(""); assertFalse(underTest.hasInflightOperations()); }