/** * {@inheritDoc} */ @Override public void start(final Future<Void> startedResult) throws Exception { this.start(); jerseyServer.start(ar -> { if (ar.succeeded()) { startedResult.complete(); } else { startedResult.fail(ar.cause()); } }); }
@Before public void setUp() { when(vertx.getOrCreateContext()).thenReturn(context); when(context.config()).thenReturn(config); jerseyVerticle = new JerseyVerticle(jerseyServer, options); jerseyVerticle.init(vertx, context); }
/** * {@inheritDoc} */ @Override public void start(final Future<Void> startedResult) throws Exception { this.start(); jerseyServer.start(ar -> { if (ar.succeeded()) { startedResult.complete(); } else { startedResult.fail(ar.cause()); } }); }
@Test public void testStart() throws Exception { jerseyVerticle.start(startedResult); verify(startedResult, never()).complete(); verify(startedResult, never()).fail(any(Throwable.class)); verify(jerseyServer).start(handlerCaptor.capture()); when(asyncResult.succeeded()).thenReturn(true).thenReturn(false); handlerCaptor.getValue().handle(asyncResult); verify(startedResult).complete(); verify(startedResult, never()).fail(any(Throwable.class)); handlerCaptor.getValue().handle(asyncResult); verify(startedResult).complete(); verify(startedResult).fail(any(Throwable.class)); }