DEV Community

Discussion on: Writing Async Tests for Vert.x using Kotlin

Collapse
 
gonne profile image
gonne

Nice article, but I assume the java equivalent should look like this:

@ExtendWith(VertxExtension.class)
public class JavaHttpServerTest {
  @Test
  @io.vertx.junit5.Timeout(value = 5, timeUnit = TimeUnit.SECONDS)
  void start_http_server(Vertx vertx, VertxTestContext testContext) {
    vertx.createHttpServer()
      .requestHandler(req -> req.response().end())
      .listen(16969)
      .onComplete(testContext.succeedingThenComplete());
  }
}
Enter fullscreen mode Exit fullscreen mode
Collapse
 
wowselim profile image
Selim Dincer

Yep, you are correct. I took the code from this example and made it use the injected VertxTestContext: vertx.io/docs/vertx-junit5/java/#_...
I'll try to update the post with a more fitting example 😉