use of io.irontest.models.assertion.HasAnMQRFH2FolderEqualToXmlAssertionProperties in project irontest by zheng-wang.
the class HasAnMQRFH2FolderEqualToXmlAssertionVerifier method verify.
/**
* @param inputs contains only one argument: the {@link MQRFH2Header label} object that the assertion is verified against
* @return
*/
public AssertionVerificationResult verify(Object... inputs) {
AssertionVerificationResult result = new AssertionVerificationResult();
HasAnMQRFH2FolderEqualToXmlAssertionProperties assertionProperties = (HasAnMQRFH2FolderEqualToXmlAssertionProperties) getAssertion().getOtherProperties();
// validate arguments
if (assertionProperties.getXml() == null) {
throw new IllegalArgumentException("XML is null.");
} else if (inputs[0] == null) {
throw new IllegalArgumentException("There is no MQRFH2 header.");
}
result.setResult(TestResult.FAILED);
MQRFH2Header mqrfh2Header = (MQRFH2Header) inputs[0];
for (MQRFH2Folder mqrfh2Folder : mqrfh2Header.getFolders()) {
String differencesStr = XMLUtils.compareXML(assertionProperties.getXml(), mqrfh2Folder.getString(), false);
if (differencesStr.length() == 0) {
result.setResult(TestResult.PASSED);
break;
}
}
return result;
}
Aggregations