New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DomXmlMessageValidator accepts any payload for an empty control message #422
Comments
Empty control message is an indicator that you are not interested in validating the message payload at all. This skips the payload message validation. This is a convention decision we made ages ago. I am not 100% happy with this either but it is the convention. In case you need to really validate for an empty message payload you should use one of the validation matchers as expected payload e.g. |
Hi @bjoerndev! Did @christophd work for you or do you have any further questions? BR, |
Hi @svettwer , thanks for looking at this. Greetings, Björn |
Hi @bjoerndev, yeah you're right. One should rethink this convention. Unfortunately this convention is not easy to change and there is actually no concrete requirement. Therefore we won't change this short term. Nevertheless, we'll keep this in mind in case that we've time for some major refactoring tasks. BR, |
In a complex special case we get an unexpected behavior of citrus XML comparison. I debugged into citrus and came to a line where I'm not sure if this is ok:
In DomXmlMessageValidator.validateMessageContent (at the moment line 342) [1] there is a
} else if (!StringUtils.hasText(controlMessagePayload)) { return; }
which causes that in case of an empty control message any payload gets accepted because the comparison ends without exception. I would expect throwing an exception or having an assert instead of the return.
Thank you for your great work and for checking this line.
[1]
citrus/modules/citrus-core/src/main/java/com/consol/citrus/validation/xml/DomXmlMessageValidator.java
Line 342 in 551834d
The text was updated successfully, but these errors were encountered: