I have an XML payload with the element ValidationFault
. Part of my validation is to confirm the ValidationFault
element occurs only once in the XML payload. Using the following Citrus Java DSL:
runner.receive(action -> action.endpoint(endpointName)
.validate("number://ValidationFault", 1));
I do not get back the expected value of 1, instead 0:
com.consol.citrus.exceptions.TestCaseFailedException: Validation failed: Values not equal for element '//ValidationFault', expected '1' but was '0'
I have manually confirmed that the response payload does contain the element in question. I also validated the XPath with an external tool and found that the XPath should be correct. I have tried with the namespaces as well, //soapenv:ValidationFault
and //:ValidationFault
, but I receive the same exception.
Edit:
This is the XML payload that is received (with some data removed):
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header/>
<SOAP-ENV:Body
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Fault>
<faultcode>soapenv:Client</faultcode>
<faultstring>ValidationFault</faultstring>
<faultactor>GetSalutation</faultactor>
<detail>
<ValidationFault
fault:retryable="false"
xmlns="http://domain/fault/2.0/"
xmlns:fault="domain/fault/2.0/">
<ErrorCode>flt-00001</ErrorCode>
<DescriptionText>A Schema Validation Failed</DescriptionText>
<Details>
<Text></Text>
</Details
<TransactionControlIdentificationID>
TBD
</TransactionControlIdentificationID>
<ZuluDateTime><ZuluDateTime>
</ValidationFault>
</detail>
</soapenv:Fault>
</SOAP-ENV:Body>
</soapenv:Envelope>