Package org.mockserver.model
Class ExpectationStep
java.lang.Object
org.mockserver.model.ObjectWithReflectiveEqualsHashCodeToString
org.mockserver.model.ObjectWithJsonToString
org.mockserver.model.ExpectationStep
Represents a single step in an ordered multi-action expectation pipeline.
Each step carries exactly ONE action target and a responder flag.
Steps without responder = true are side-effects (like beforeActions:
fire-and-forget webhooks/callbacks). Exactly one step in the list must be
marked as the responder; that step's action produces the HTTP response.
Side-effect targets (responder = false)
httpRequest— webhook (HTTP call to an external URL)httpClassCallback— server-side class callbackhttpObjectCallback— WebSocket object callbackhttpForward— side-effect forward (response discarded)httpOverrideForwardedRequest— side-effect forward-replace
Responder targets (responder = true)
httpResponse— static responsehttpForward— proxy forward (response returned to client)httpOverrideForwardedRequest— forward-replace (response returned)httpClassCallback— class callback responsehttpObjectCallback— object callback responsehttpError— connection-level error (cannot combine with other steps)
Side-effect step controls
blocking— when true (default) the pipeline waits for completiontimeout— max wait for a blocking side-effectfailurePolicy— FAIL_FAST or BEST_EFFORT on failure/timeout
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanSide-effect steps only: whentrue(the default when unset) the pipeline waits for this step to complete before proceeding; whenfalsethe step is started but not awaited.getDelay()Side-effect steps only: what to do when a blocking step fails or times out.Side-effect steps only: maximum time to wait for a blocking step.inthashCode()static ExpectationStepstep()withBlocking(Boolean blocking) withFailurePolicy(FailurePolicy failurePolicy) withHttpClassCallback(HttpClassCallback httpClassCallback) withHttpError(HttpError httpError) withHttpForward(HttpForward httpForward) withHttpObjectCallback(HttpObjectCallback httpObjectCallback) withHttpOverrideForwardedRequest(HttpOverrideForwardedRequest httpOverrideForwardedRequest) withHttpRequest(HttpRequest httpRequest) withHttpResponse(HttpResponse httpResponse) withResponder(Boolean responder) withTimeout(Delay timeout) Methods inherited from class org.mockserver.model.ObjectWithJsonToString
toStringMethods inherited from class org.mockserver.model.ObjectWithReflectiveEqualsHashCodeToString
fieldsExcludedFromEqualsAndHashCode
-
Constructor Details
-
ExpectationStep
public ExpectationStep()
-
-
Method Details
-
step
-
getHttpRequest
-
withHttpRequest
-
getHttpClassCallback
-
withHttpClassCallback
-
getHttpObjectCallback
-
withHttpObjectCallback
-
getHttpForward
-
withHttpForward
-
getHttpOverrideForwardedRequest
-
withHttpOverrideForwardedRequest
public ExpectationStep withHttpOverrideForwardedRequest(HttpOverrideForwardedRequest httpOverrideForwardedRequest) -
getHttpResponse
-
withHttpResponse
-
getHttpError
-
withHttpError
-
getResponder
-
withResponder
-
getDelay
-
withDelay
-
getBlocking
Side-effect steps only: whentrue(the default when unset) the pipeline waits for this step to complete before proceeding; whenfalsethe step is started but not awaited. Ignored for responder steps. -
withBlocking
-
getTimeout
Side-effect steps only: maximum time to wait for a blocking step. -
withTimeout
-
getFailurePolicy
Side-effect steps only: what to do when a blocking step fails or times out. -
withFailurePolicy
-
equals
- Overrides:
equalsin classObjectWithReflectiveEqualsHashCodeToString
-
hashCode
public int hashCode()- Overrides:
hashCodein classObjectWithReflectiveEqualsHashCodeToString
-