eclipse-vertx / vertx-junit5

Testing Vert.x applications with JUnit 5
Apache License 2.0
44 stars 32 forks source link

Allow to pre-configure vertx instances with VertxExtension #56

Closed u6f6o closed 5 years ago

u6f6o commented 5 years ago

This pull request allows to pre-configure vertx instances before they'll be injected in test/setup/teardown methods.

Junit5 offers a @RegisterExtension annotation that allows to configure extension objects. More information can be found here.

  @RegisterExtension
  private VertxExtension vertxExtension = new VertxExtension.Builder()
      .vertx(() -> Vertx.vertx(
        new VertxOptions()
          .setMetricsOptions(
            new MicrometerMetricsOptions()
              .setPrometheusOptions(new VertxPrometheusOptions().setEnabled(true))
              .setEnabled(true))))
      .build(); 
jponge commented 5 years ago

Thanks for your PR.

Would you have tests and documentation to support the change?

u6f6o commented 5 years ago

@jponge: Welcome. Sure, as soon as I find time I'll provide tests and documentation.

u6f6o commented 5 years ago

@jponge: the first try to provide a more flexible version of the VertxExtension looked quite promising, further investigation and tests revealed though, that it is not working as expected in all scenarios :-( I tried to dig deeper into the junit5 framework but gave up at some point since I am currently lacking the time. I would suggest to close the PR for now.

jponge commented 5 years ago

Ok thanks @u6f6o