### Question:
DefaultWhenEventBus implements WhenEventBus { @Override public Promise<Void> close() { return adapter.toPromise(eventBus::close); } @Inject  DefaultWhenEventBus(Vertx vertx, PromiseAdapter adapter);  DefaultWhenEventBus(Vertx vertx, When when);  DefaultWhenEventBus(EventBus eventBus, PromiseAdapter adapter);  DefaultWhenEventBus(EventBus eventBus, When when); @Override EventBus getEventBus(); @Override Promise<Void> close(); @Override Promise<Message<T>> send(String address, Object message); @Override Promise<Message<T>> send(String address, Object message, DeliveryOptions options);  }### Answer:
@Test public void testClose_Success() throws Exception { Done<Void> done = new Done<>(); whenEventBus.close().then(done.onFulfilled, done.onRejected); verify(eventBus).close(voidHandlerCaptor.capture()); when(voidResult.succeeded()).thenReturn(true); voidHandlerCaptor.getValue().handle(voidResult); done.assertFulfilled(); }
@Test public void testClose_Failed() throws Exception { Done<Void> done = new Done<>(); whenEventBus.close().then(done.onFulfilled, done.onRejected); verify(eventBus).close(voidHandlerCaptor.capture()); Throwable t = new Throwable(); when(voidResult.cause()).thenReturn(t); voidHandlerCaptor.getValue().handle(voidResult); done.assertRejected(); assertEquals(t, done.getCause()); }