Shlomy Sheps
10/13/2024, 1:41 PMjava.lang.NullPointerException: Cannot invoke "com.github.tomakehurst.wiremock.junit.Stubbing.stubFor(com.github.tomakehurst.wiremock.client.MappingBuilder)" because "this.stubbing" is null
at com.github.tomakehurst.wiremock.junit.DslWrapper.stubFor(DslWrapper.java:261)
at ct.com.zebra.secondary.series.templates.TemplatesStepdefs.configureWireMockStub(TemplatesStepdefs.java:172)
at ✽.I configure wire mock to retrieve image input/zebra.png for studyId:cbbbc88f-c897-4ac9-b4ee-33e6bde32480 seriesId:214.2639356445.26983.21153.46400.80153539354141 dicomId:214.405089174.64947.23898.43714.188026663186433 fileType:JPG
this is how i create the wiremock:
@RegisterExtension
static WireMockExtension wireMockServer = WireMockExtension.newInstance()
.options(wireMockConfig()
.needClientAuth(false)
.httpsPort(8081)
.port(8082))
.build();
this is where i am trying to create the stub, and what casue the exception:
@And("I configure wire mock to retrieve image {} for studyId:{} seriesId:{} dicomId:{} fileType:{}")
public void configureWireMockStub(String imagePath, String studyId, String seriesId, String dicomId, String fileType) throws IOException {
byte[] fileContent = IOUtils.toByteArray(this.getClass().getClassLoader().getResourceAsStream(imagePath));
wireMockServer.stubFor(get(urlEqualTo("/study/%s/series/%s/dcm/%s?fileType=%s"
.formatted(studyId, seriesId, dicomId, fileType)))
.willReturn(aResponse()
.withBody(fileContent)));
this is the gradle config:
// Wiremock
testImplementation 'org.wiremock:wiremock-standalone:3.9.1'
Tom
10/14/2024, 9:05 AMShlomy Sheps
10/14/2024, 12:31 PMTom
10/14/2024, 3:42 PMWireMockExtension:#216
and see if it manages to run the start()
call without throwing.