### Question:
InFlightRequestTracker { public CompletableFuture<Void> awaitAsync() { phaser.arriveAndDeregister(); return terminationFuture; }  void registerRequest(); void deregisterRequest(); CompletableFuture<Void> awaitAsync();  }### Answer:
@Test public void testShouldFinishAwaitAsyncImmediatelyIfNoRequests() { assertTrue(inFlightRequestTracker.awaitAsync().isDone()); }
@Test public void testAwaitAsyncIsIdempotent() { final CompletableFuture<Void> awaitFuture = inFlightRequestTracker.awaitAsync(); assertTrue(awaitFuture.isDone()); assertSame( "The reference to the future must not change", awaitFuture, inFlightRequestTracker.awaitAsync()); }