vertx-unit icon indicating copy to clipboard operation
vertx-unit copied to clipboard

Better future support in unit tests

Open gofabian opened this issue 5 years ago • 1 comments

I wrote a small extension to VertxUnitRunner that adds support for test methods with "Future" return type.

Usage example:

@Test
public Future test() {
  return Future.succeededFuture();
}

The reason for this approach is that I would like to eliminate boilerplate code. I have many tests that call async = context.async() and async.complete(). With my FutureVertxRunner in most cases test methods will not need to use TestContext explicitly anymore.

https://github.com/gofabian/vertx-unit-future

What do you think about that? If anybody likes this way of testing I would create a PR to integrate this into the original VertxUnitRunner.

gofabian avatar Nov 25 '18 14:11 gofabian

I believe it's good contribution, however we should resolve this in vertx 3.x and not in vertx 4 that will advocate to use CompletionStage.

vietj avatar Nov 25 '18 16:11 vietj