@Test public void testWorkerNonBlocking(TestContext context) throws InterruptedException, ExecutionException { BlockingFoo.reset(); Async async = context.async(); BlockingFoo foo = weld.select(BlockingFoo.class).get(); AsyncWorker.from(vertx).perform(foo::getMessageNonBlocking).thenAccept(m -> { context.assertEquals(BlockingFoo.class.getName(), m); async.complete(); }); } }
@Test public void testWorker(TestContext context) throws InterruptedException, ExecutionException { BlockingFoo.reset(); Async async = context.async(); BlockingFoo foo = weld.select(BlockingFoo.class).get(); AsyncWorker.from(vertx).performBlocking(foo::getMessage).thenAccept(m -> { context.assertEquals("ping", m); async.complete(); }); context.assertEquals(1, async.count()); BlockingFoo.complete("ping"); }