@Test
public void testMockedXpathMatch(){
final HttpServletRequest httpServletRequest = getMockedHttpServletRequest(REQUEST_BODY);
final HttpServletResponse httpServletResponse = getHttpServletResponse();
final SoapXPathExpression xPathExpression = new SoapXPathExpression();
xPathExpression.setExpression("//ServiceName/value[text()='Input']");
final SoapOperation soapOperation = getSoapOperation();
soapOperation.getMockResponses().get(0).getXpathExpressions().add(xPathExpression);
soapOperation.setResponseStrategy(SoapResponseStrategy.XPATH_INPUT);
final IdentifySoapOperationOutput identifySoapOperationOutput = IdentifySoapOperationOutput.builder()
.projectId(PROJECT_ID)
.portId(SOAP_PORT_ID)
.operationId(SOAP_OPERATION_ID)
.operation(soapOperation)
.build();
when(serviceProcessor.process(any(IdentifySoapOperationInput.class))).thenReturn(identifySoapOperationOutput);
when(httpServletRequest.getRequestURI()).thenReturn(CONTEXT + SLASH + MOCK + SLASH + SOAP + SLASH + PROJECT +
SLASH + PROJECT_ID + SLASH + SOAP_PORT_ID);
final ResponseEntity responseEntity = soapServiceController.postMethod(PROJECT_ID, httpServletRequest, httpServletResponse);
Assert.assertEquals(RESPONSE_BODY, responseEntity.getBody());
Assert.assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
Assert.assertEquals(true, responseEntity.getHeaders().containsKey(CONTENT_TYPE_HEADER));
Assert.assertEquals(true, responseEntity.getHeaders().containsKey(ACCEPT_HEADER));
Assert.assertEquals(APPLICATION_XML, responseEntity.getHeaders().get(CONTENT_TYPE_HEADER).get(0));
Assert.assertEquals(APPLICATION_XML, responseEntity.getHeaders().get(ACCEPT_HEADER).get(0));
}