Reputation: 1
I'm in need of some help with the following: Upon verifying the actual body content to be equal to the expected I run into the following issue:
CLICK HERE FOR THE IMAGE -> Expected vs Actual body comparison
So the only difference here is the [equalTo] value, making my test fail.
Below is part of my test setup where equalTo() is being used inside the withRequestBody().
@QuarkusIntegrationTest
@ConnectWireMock
public class MYTestIT {
private static final String ENTITY_SAMPLE =
( "Entity{entity=<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">"
+ "<SOAP-ENV:Header><requestingParty xmlns=\"http://schemas.xmlsoap.org/soap/envelope/\">12345678"
+ "</requestingParty></SOAP-ENV:Header><SOAP-ENV:Body SOAP-ENV:encodingStyle=\"UTF-8\"><note>\n"
+ "<to>Tove</to>\n"
+ "<from>Jani</from>\n"
+ "<heading>Reminder</heading>\n"
+ "<body>Don't forget me this weekend!</body>\n"
+ "</note></SOAP-ENV:Body></SOAP-ENV:Envelope>, variant=Variant[mediaType=application/xml;charset=UTF-8, language=null, encoding=null], annotations=[]}" );
@Test
void requestBodyTest() {
// Call expected to get triggered
wireMock.register( post( urlEqualTo( "/my/url" ) ).willReturn( aResponse()
.withStatus( Response.Status.OK.getStatusCode() )
.withHeader( "Content-Type", MediaType.APPLICATION_XML )
.withBody( "<somexml/>" ) ) );
// Call to eventually trigger call above
given()
.auth().preemptive().basic( "john.doe", "password" )
.post( "/api/v2/uploads" )
.then()
.statusCode( RestResponse.StatusCode.CREATED );
// Asserting the requestbody of the triggered request to equal ENTITY_SAMPLE
wireMock.verifyThat( postRequestedFor( urlEqualTo( "/my/url" ) ).withRequestBody( equalTo( ENITTY_SAMPLE ) ) );
}
}
I've tried multiple variants with contains(), matching(...), but often with the same result.
Looking forward to your response.
I've tried multiple variants with contains(), matching(...), but often with the same result.
Upvotes: 0
Views: 113