vertx-unit
vertx-unit copied to clipboard
Better future support in unit tests
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.
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
.