Search in sources :

Example 1 with ExpectedRequest

use of httpstub.ExpectedRequest in project verify-hub by alphagov.

the class MatchingServiceRequestSenderTest method andPolicyShouldReceiveTheResult.

private void andPolicyShouldReceiveTheResult(SessionId sessionId, String resultPath) {
    await().atMost(5, TimeUnit.SECONDS).until(() -> !policyStubRule.getRecordedRequest().isEmpty());
    RecordedRequest recordedRequest = policyStubRule.getLastRequest();
    String path = UriBuilder.fromPath(resultPath).build(sessionId).getPath();
    ExpectedRequest expectedRequest = ExpectedRequestBuilder.expectRequest().withPath(path).build();
    assertThat(expectedRequest.applies(recordedRequest)).describedAs("The response was not sent to the correct path: expected '%s', but got '%s'", path, recordedRequest.getPath()).isTrue();
}
Also used : RecordedRequest(httpstub.RecordedRequest) ExpectedRequest(httpstub.ExpectedRequest)

Aggregations

ExpectedRequest (httpstub.ExpectedRequest)1 RecordedRequest (httpstub.RecordedRequest)1