### Question:
DefaultWhenVertx implements WhenVertx { @Override public Promise<String> deployVerticle(Verticle verticle) { return adapter.toPromise(handler -> vertx.deployVerticle(verticle, handler)); } @Inject  DefaultWhenVertx(Vertx vertx, PromiseAdapter adapter);  DefaultWhenVertx(Vertx vertx, When when); @Override Promise<String> deployVerticle(Verticle verticle); @Override Promise<String> deployVerticle(Verticle verticle, DeploymentOptions options); @Override Promise<String> deployVerticle(String name); @Override Promise<String> deployVerticle(String name, DeploymentOptions options); @Override Promise<Void> undeploy(String deploymentID); @Override Promise<T> executeBlocking(Handler<Future<T>> blockingCodeHandler, boolean ordered);  }### Answer:
@Test public void testDeployVerticle_Identifier_Success1() throws Exception { when(result.succeeded()).thenReturn(true); whenVertx.deployVerticle(identifier).then(done.onFulfilled, done.onRejected); verify(vertx).deployVerticle(eq(identifier), handlerCaptor.capture()); handlerCaptor.getValue().handle(result); done.assertFulfilled(); }
@Test public void testDeployVerticle_Identifier_Fail1() throws Exception { when(result.succeeded()).thenReturn(false); whenVertx.deployVerticle(identifier).then(done.onFulfilled, done.onRejected); verify(vertx).deployVerticle(eq(identifier), handlerCaptor.capture()); handlerCaptor.getValue().handle(result); done.assertRejected(); }
@Test public void testDeployVerticle_Identifier_Success2() throws Exception { when(result.succeeded()).thenReturn(true); whenVertx.deployVerticle(identifier, options).then(done.onFulfilled, done.onRejected); verify(vertx).deployVerticle(eq(identifier), eq(options), handlerCaptor.capture()); handlerCaptor.getValue().handle(result); done.assertFulfilled(); }
@Test public void testDeployVerticle_Identifier_Fail2() throws Exception { when(result.succeeded()).thenReturn(false); whenVertx.deployVerticle(identifier, options).then(done.onFulfilled, done.onRejected); verify(vertx).deployVerticle(eq(identifier), eq(options), handlerCaptor.capture()); handlerCaptor.getValue().handle(result); done.assertRejected(); }
@Test public void testDeployVerticle_Verticle_Success1() throws Exception { when(result.succeeded()).thenReturn(true); whenVertx.deployVerticle(verticle).then(done.onFulfilled, done.onRejected); verify(vertx).deployVerticle(eq(verticle), handlerCaptor.capture()); handlerCaptor.getValue().handle(result); done.assertFulfilled(); }
@Test public void testDeployVerticle_Verticle_Fail1() throws Exception { when(result.succeeded()).thenReturn(false); whenVertx.deployVerticle(verticle).then(done.onFulfilled, done.onRejected); verify(vertx).deployVerticle(eq(verticle), handlerCaptor.capture()); handlerCaptor.getValue().handle(result); done.assertRejected(); }
@Test public void testDeployVerticle_Verticle_Success2() throws Exception { when(result.succeeded()).thenReturn(true); whenVertx.deployVerticle(verticle, options).then(done.onFulfilled, done.onRejected); verify(vertx).deployVerticle(eq(verticle), eq(options), handlerCaptor.capture()); handlerCaptor.getValue().handle(result); done.assertFulfilled(); }
@Test public void testDeployVerticle_Verticle_Fail2() throws Exception { when(result.succeeded()).thenReturn(false); whenVertx.deployVerticle(verticle, options).then(done.onFulfilled, done.onRejected); verify(vertx).deployVerticle(eq(verticle), eq(options), handlerCaptor.capture()); handlerCaptor.getValue().handle(result); done.assertRejected(); }