Search in sources :

Example 1 with BinaryEqualToPattern

use of com.github.tomakehurst.wiremock.matching.BinaryEqualToPattern in project junit-servers by mjeanroy.

the class WireMockTestUtils method assertUploadRequest.

/**
 * Verify that a given request has been triggered.
 *
 * @param endpoint Request endpoint.
 * @param method Request method.
 */
static void assertUploadRequest(String endpoint, HttpMethod method, File file) {
    UrlPattern urlPattern = urlEqualTo(endpoint);
    RequestMethod rqMethod = new RequestMethod(method.name());
    RequestPatternBuilder rq = new RequestPatternBuilder(rqMethod, urlPattern).withAllRequestBodyParts(new MultipartValuePatternBuilder().withName(file.getName()).withBody(new BinaryEqualToPattern(TestUtils.readFile(file))));
    WireMock.verify(1, rq);
}
Also used : MultipartValuePatternBuilder(com.github.tomakehurst.wiremock.matching.MultipartValuePatternBuilder) RequestMethod(com.github.tomakehurst.wiremock.http.RequestMethod) BinaryEqualToPattern(com.github.tomakehurst.wiremock.matching.BinaryEqualToPattern) RequestPatternBuilder(com.github.tomakehurst.wiremock.matching.RequestPatternBuilder) UrlPattern(com.github.tomakehurst.wiremock.matching.UrlPattern)

Aggregations

RequestMethod (com.github.tomakehurst.wiremock.http.RequestMethod)1 BinaryEqualToPattern (com.github.tomakehurst.wiremock.matching.BinaryEqualToPattern)1 MultipartValuePatternBuilder (com.github.tomakehurst.wiremock.matching.MultipartValuePatternBuilder)1 RequestPatternBuilder (com.github.tomakehurst.wiremock.matching.RequestPatternBuilder)1 UrlPattern (com.github.tomakehurst.wiremock.matching.UrlPattern)1