Class RequestExpectations

java.lang.Object
com.mx.path.testing.request.RequestExpectations

public class RequestExpectations extends Object
  • Constructor Details

    • RequestExpectations

      public RequestExpectations()
  • Method Details

    • getRequestAllowances

      public static List<RequestExpectation> getRequestAllowances()
    • getRequestExpectations

      public static List<RequestExpectation> getRequestExpectations()
    • addRequest

      public static void addRequest(com.mx.path.core.common.connect.Request<?,?> request)
      Capture and store a handled request. This is called every time a request is matched and handled by any expectation
      Parameters:
      request - received request
    • allowConnection

      public static RequestExpectation allowConnection(RequestMatcher requestMatcher)
    • expectConnection

      public static RequestExpectation expectConnection(RequestMatcher requestMatcher)
      Create a request expectation. Will fail verification if not invoked.
      Parameters:
      requestMatcher - matching rules
      Returns:
      self
    • request

      public static com.mx.path.core.common.connect.Request<?,?> request()
      Get the first request executed against expectations.
      Returns:
      first request
    • request

      public static com.mx.path.core.common.connect.Request<?,?> request(RequestMatcher requestMatcher)
      Get the first matching request executed against expectations.
      Parameters:
      requestMatcher - matching rules
      Returns:
      first request
    • requests

      public static List<com.mx.path.core.common.connect.Request<?,?>> requests()
      Get the requests received by expectations (does not include allowances). Requests are in the order they were received.
      Returns:
      list of requests
    • requests

      public static List<com.mx.path.core.common.connect.Request<?,?>> requests(RequestMatcher requestMatcher)
      Get the filtered requests received by expectations (does not include allowances). Requests are in the order they were received.
      Returns:
      list of requests
    • reset

      public static void reset()
      Clears out expectations. Should be invoked between tests.
    • stubConnection

      public static RequestExpectation stubConnection(RequestMatcher requestMatcher)
      Creates a request expectation that is not expected to be invoked
      Parameters:
      requestMatcher -
      Returns:
      new expectation
    • verifyConnectionExpectations

      public static boolean verifyConnectionExpectations()
      Verifies that all expected requests were made. Raises exception if expectations are not met.
      Returns:
      true if all requests were made. (this return value allows this to be invoked in then: section of Spock test.)