You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to propose to adapt the VertxExtension in order to allow a manual configuration of the Vertx instance before injecting it in the test/setup/teardown methods.
Junit5 offers a @RegisterExtension annotation that allows to configure extension objects. More information can be found here.
Thus, the current mechanics, to simply inject a Vertx instance would still work, while users who'd like to adapt the settings of the Vertx instance for a given test case could still benefit from the VertxExtension.
In order to verify my proposal, I created a copy of the existing VertxExtension and added/adapted following code:
Add a new field with a supplier that returns a Vertx instance on invocation
private final Supplier<Vertx> vertxSupplier;
Add a default constructor and a constructor with the supplier parameter
public VertxExtension() {
this(Vertx::vertx);
}
public VertxExtension(Supplier<Vertx> vertxSupplier) {
this.vertxSupplier = vertxSupplier;
}
Adapt the resolveParameter method to invoke the vertxSupplier
I'd like to propose to adapt the
VertxExtension
in order to allow a manual configuration of theVertx
instance before injecting it in the test/setup/teardown methods.Junit5 offers a
@RegisterExtension
annotation that allows to configure extension objects. More information can be found here.Thus, the current mechanics, to simply inject a
Vertx
instance would still work, while users who'd like to adapt the settings of theVertx
instance for a given test case could still benefit from theVertxExtension
.In order to verify my proposal, I created a copy of the existing
VertxExtension
and added/adapted following code:Vertx
instance on invocationvertxSupplier
In the test class itself, we could provide a configured vertx instance instead of sticking with the default (kotlin code):
Hope you consider this proposal.
The text was updated successfully, but these errors were encountered: