mockserver-client-java/src/main/java/org/mockserver/client/MockServerClient.java
@SuppressWarnings("DuplicatedCode")
    public MockServerClient verify(HttpRequest httpRequest, VerificationTimes times) throws AssertionError {
        if (httpRequest == null) {
            throw new IllegalArgumentException("verify(HttpRequest, VerificationTimes) requires a non null HttpRequest object");
        }
        if (times == null) {
            throw new IllegalArgumentException("verify(HttpRequest, VerificationTimes) requires a non null VerificationTimes object");
        }

        Verification verification = verification().withRequest(httpRequest).withTimes(times);
        String result = sendRequest(
            request()
                .withMethod("PUT")
                .withContentType(APPLICATION_JSON_UTF_8)
                .withPath(calculatePath("verify"))
                .withBody(verificationSerializer.serialize(verification), StandardCharsets.UTF_8)
        ).getBodyAsString();

        if (result != null && !result.isEmpty()) {
            throw new AssertionError(result);
        }
        return clientClass.cast(this);
    }
/**
     * Verify a request has been sent for example:
     * <pre>
     * mockServerClient
     *  .verify(
     *      request()
     *          .withPath("/some_path")
     *          .withBody("some_request_body"),
     *      VerificationTimes.exactly(3)
     *  );
     * </pre>
     * VerificationTimes supports multiple static factory methods:
     * <p>
     * once()      - verify the request was only received once
     * exactly(n)  - verify the request was only received exactly n times
     * atLeast(n)  - verify the request was only received at least n times
     *
     * @param httpRequest the http request that must be matched for this verification to pass
     * @param times       the number of times this request must be matched
     * @throws AssertionError if the request has not been found
     */


@param httpRequest the http request that must be matched for this verification to pass
@param times       the number of times this request must be matched
@throws AssertionError if the request has not been found
@param httpRequest the http request that must be matched for this verification to pass @param times the number of times this request must be matched @throws AssertionError if the request has not been found
@SuppressWarnings("DuplicatedCode")
    public MockServerClient verify(HttpRequest httpRequest, VerificationTimes times) throws AssertionError {
        if (httpRequest == null) {
            throw new IllegalArgumentException("verify(HttpRequest, VerificationTimes) requires a non null HttpRequest object");
        }
        if (times == null) {
            throw new IllegalArgumentException("verify(HttpRequest, VerificationTimes) requires a non null VerificationTimes object");
        }
        Verification verification = verification().withRequest(httpRequest).withTimes(times);
        String result = sendRequest(
            request()
                .withMethod("PUT")
                .withContentType(APPLICATION_JSON_UTF_8)
                .withPath(calculatePath("verify"))
                .withBody(verificationSerializer.serialize(verification), StandardCharsets.UTF_8)
        ).getBodyAsString();
        if (result != null && !result.isEmpty()) {
            throw new AssertionError(result);
        }
        return clientClass.cast(this);
    }
@ SuppressWarnings ( "DuplicatedCode" ) public MockServerClient verify ( HttpRequest httpRequest , VerificationTimes times ) throws AssertionError { if ( httpRequest == null ) { throw new IllegalArgumentException ( "verify(HttpRequest, VerificationTimes) requires a non null HttpRequest object" ) ; } if ( times == null ) { throw new IllegalArgumentException ( "verify(HttpRequest, VerificationTimes) requires a non null VerificationTimes object" ) ; } Verification verification = verification ( ) . withRequest ( httpRequest ) . withTimes ( times ) ; String result = sendRequest ( request ( ) . withMethod ( "PUT" ) . withContentType ( APPLICATION_JSON_UTF_8 ) . withPath ( calculatePath ( "verify" ) ) . withBody ( verificationSerializer . serialize ( verification ) , StandardCharsets . UTF_8 ) ) . getBodyAsString ( ) ; if ( result != null && ! result . isEmpty ( ) ) { throw new AssertionError ( result ) ; } return clientClass . cast ( this ) ; }
Verify a request has been sent for example:
 <pre>
 mockServerClient
  .verify(
      request()
          .withPath("/some_path")
          .withBody("some_request_body"),
      VerificationTimes.exactly(3)
  );
 </pre>
 VerificationTimes supports multiple static factory methods:
 <p>
 once()      - verify the request was only received once
 exactly(n)  - verify the request was only received exactly n times
 atLeast(n)  - verify the request was only received at least n times
Verify a request has been sent for example : <pre > mockServerClient . verify ( request () . withPath ( " / some_path " ) . withBody ( " some_request_body " ) VerificationTimes . exactly ( 3 ) ) ; < / pre > VerificationTimes supports multiple static factory methods : <p > once () - verify the request was only received once exactly ( n ) - verify the request was only received exactly n times atLeast ( n ) - verify the request was only received at least n times