Search in sources :

Example 1 with AllHTTPStubRequestsMatchedAssertionVerificationResult

use of io.irontest.models.assertion.AllHTTPStubRequestsMatchedAssertionVerificationResult in project irontest by zheng-wang.

the class AllHTTPStubRequestsMatchedAssertionVerifier method verify.

@Override
public AssertionVerificationResult verify(Object... inputs) {
    AllHTTPStubRequestsMatchedAssertionVerificationResult result = new AllHTTPStubRequestsMatchedAssertionVerificationResult();
    List<ServeEvent> allStubRequests = (List<ServeEvent>) inputs[0];
    List<ServeEvent> unmatchedStubRequests = new ArrayList<>();
    for (ServeEvent serveEvent : allStubRequests) {
        if (!serveEvent.getWasMatched()) {
            unmatchedStubRequests.add(serveEvent);
        }
    }
    result.setUnmatchedStubRequests(unmatchedStubRequests);
    if (unmatchedStubRequests.isEmpty()) {
        result.setResult(TestResult.PASSED);
    } else {
        result.setResult(TestResult.FAILED);
    }
    return result;
}
Also used : AllHTTPStubRequestsMatchedAssertionVerificationResult(io.irontest.models.assertion.AllHTTPStubRequestsMatchedAssertionVerificationResult) ArrayList(java.util.ArrayList) ServeEvent(com.github.tomakehurst.wiremock.stubbing.ServeEvent) List(java.util.List) ArrayList(java.util.ArrayList)

Aggregations

ServeEvent (com.github.tomakehurst.wiremock.stubbing.ServeEvent)1 AllHTTPStubRequestsMatchedAssertionVerificationResult (io.irontest.models.assertion.AllHTTPStubRequestsMatchedAssertionVerificationResult)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1