wiremock-spring-boot icon indicating copy to clipboard operation
wiremock-spring-boot copied to clipboard

Injecting Wiremock does not work with JUnit @Nested

Open calnighters opened this issue 1 year ago • 1 comments
trafficstars

When trying to use a global WiremockServer in a test inside a nested test class annotated with @Nested, the test cannot invoke any stubs because the WiremockServer is null. I get the below running in a nested class, but without the nesting then the tests run fine and the wiremock works as expected.

java.lang.NullPointerException: Cannot invoke "com.github.tomakehurst.wiremock.WireMockServer.stubFor(com.github.tomakehurst.wiremock.client.MappingBuilder)" because "this.this$0.graphWiremock" is null

calnighters avatar Nov 27 '23 19:11 calnighters

Hi @calnighters Can you share your test setup? I've tried to reproduce and I couldn't. Verify if this is still an issue, if so share some snippet. Thank you.

chriseteka avatar Jan 15 '24 17:01 chriseteka