Search in sources :

Example 1 with HasAnMQRFH2FolderEqualToXmlAssertionProperties

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;
}
Also used : MQRFH2Header(io.irontest.models.teststep.MQRFH2Header) AssertionVerificationResult(io.irontest.models.assertion.AssertionVerificationResult) MQRFH2Folder(io.irontest.models.teststep.MQRFH2Folder) HasAnMQRFH2FolderEqualToXmlAssertionProperties(io.irontest.models.assertion.HasAnMQRFH2FolderEqualToXmlAssertionProperties)

Aggregations

AssertionVerificationResult (io.irontest.models.assertion.AssertionVerificationResult)1 HasAnMQRFH2FolderEqualToXmlAssertionProperties (io.irontest.models.assertion.HasAnMQRFH2FolderEqualToXmlAssertionProperties)1 MQRFH2Folder (io.irontest.models.teststep.MQRFH2Folder)1 MQRFH2Header (io.irontest.models.teststep.MQRFH2Header)1