public class ForwardChainExpectation extends Object
Modifier and Type | Method and Description |
---|---|
Expectation[] |
error(HttpError httpError)
Return error when expectation is matched
|
Expectation[] |
forward(ExpectationForwardCallback expectationForwardCallback)
Call method on object locally or remotely (over web socket)
to generate request to forward when expectation is matched
|
Expectation[] |
forward(ExpectationForwardCallback expectationForwardCallback,
Delay delay)
Call method on object locally or remotely (over web socket)
to generate request to forward when expectation is matched
|
Expectation[] |
forward(ExpectationForwardCallback expectationForwardCallback,
ExpectationForwardAndResponseCallback expectationForwardResponseCallback)
Call method on object locally or remotely (over web socket)
to generate request to forward when expectation is matched
|
Expectation[] |
forward(ExpectationForwardCallback expectationForwardCallback,
ExpectationForwardAndResponseCallback expectationForwardResponseCallback,
Delay delay)
Call method on object locally or remotely (over web socket)
to generate request to forward when expectation is matched
|
Expectation[] |
forward(HttpClassCallback httpClassCallback)
Call method on local class in same JVM implementing ExpectationResponseCallback
to generate request to forward when expectation is matched
|
Expectation[] |
forward(HttpForward httpForward)
Forward request to the specified host and port when expectation is matched
|
Expectation[] |
forward(HttpOverrideForwardedRequest httpOverrideForwardedRequest)
Override fields, headers, and cookies etc in request being forwarded with
specified fields, headers and cookies, etc in the specified request
when expectation is matched
|
Expectation[] |
forward(HttpTemplate httpTemplate)
Evaluate Velocity or JavaScript template to generate
request to forward when expectation is matched
|
Expectation[] |
respond(ExpectationResponseCallback expectationResponseCallback)
Call method on object locally or remotely (over web socket)
to generate response to return when expectation is matched
|
Expectation[] |
respond(ExpectationResponseCallback expectationResponseCallback,
Delay delay)
Call method on object locally or remotely (over web socket)
to generate response to return when expectation is matched
|
Expectation[] |
respond(HttpClassCallback httpClassCallback)
Call method on local class in same JVM implementing ExpectationResponseCallback
to generate response to return when expectation is matched
|
Expectation[] |
respond(HttpResponse httpResponse)
Return response when expectation is matched
|
Expectation[] |
respond(HttpTemplate httpTemplate)
Evaluate Velocity or JavaScript template to generate response
to return when expectation is matched
|
ForwardChainExpectation |
withId(String id)
Set id of this expectation which can be used to update this expectation
later or for clearing or verifying by expectation id.
|
ForwardChainExpectation |
withPriority(int priority)
Set priority of this expectation which is used to determin the matching
order of expectations when a request is received.
|
public ForwardChainExpectation withId(String id)
Set id of this expectation which can be used to update this expectation later or for clearing or verifying by expectation id.
Note: Each unique expectation must have a unique id otherwise this expectation will update a existing expectation with the same id.
id
- unique string for expectation's idpublic ForwardChainExpectation withPriority(int priority)
Set priority of this expectation which is used to determin the matching order of expectations when a request is received.
Matching is ordered by priority (highest first) then creation (earliest first).
priority
- expectation's prioritypublic Expectation[] respond(HttpResponse httpResponse)
httpResponse
- response to returnpublic Expectation[] respond(HttpTemplate httpTemplate)
httpTemplate
- Velocity or JavaScript template used to generate responsepublic Expectation[] respond(HttpClassCallback httpClassCallback)
The callback class must: - implement org.mockserver.mock.action.ExpectationResponseCallback - have a zero argument constructor - be available in the classpath of the MockServer
httpClassCallback
- class to callback as a fully qualified class name, i.e. "com.foo.MyExpectationResponseCallback"public Expectation[] respond(ExpectationResponseCallback expectationResponseCallback)
expectationResponseCallback
- object to call locally or remotely to generate responsepublic Expectation[] respond(ExpectationResponseCallback expectationResponseCallback, Delay delay)
expectationResponseCallback
- object to call locally or remotely to generate responsepublic Expectation[] forward(HttpForward httpForward)
httpForward
- host and port to forward topublic Expectation[] forward(HttpTemplate httpTemplate)
httpTemplate
- Velocity or JavaScript template used to generate responsepublic Expectation[] forward(HttpClassCallback httpClassCallback)
The callback class must: - implement org.mockserver.mock.action.ExpectationForwardCallback or org.mockserver.mock.action.ExpectationForwardAndResponseCallback - have a zero argument constructor - be available in the classpath of the MockServer
httpClassCallback
- class to callback as a fully qualified class name, i.e. "com.foo.MyExpectationResponseCallback"public Expectation[] forward(ExpectationForwardCallback expectationForwardCallback)
expectationForwardCallback
- object to call locally or remotely to generate requestpublic Expectation[] forward(ExpectationForwardCallback expectationForwardCallback, ExpectationForwardAndResponseCallback expectationForwardResponseCallback)
expectationForwardCallback
- object to call locally or remotely to generate requestpublic Expectation[] forward(ExpectationForwardCallback expectationForwardCallback, Delay delay)
expectationForwardCallback
- object to call locally or remotely to generate requestpublic Expectation[] forward(ExpectationForwardCallback expectationForwardCallback, ExpectationForwardAndResponseCallback expectationForwardResponseCallback, Delay delay)
expectationForwardCallback
- object to call locally or remotely to generate requestpublic Expectation[] forward(HttpOverrideForwardedRequest httpOverrideForwardedRequest)
httpOverrideForwardedRequest
- contains request to override request being forwardedpublic Expectation[] error(HttpError httpError)
httpError
- error to returnCopyright © 2022. All rights reserved.