@NotThreadSafe
public interface RequestExpectationBuilder
Builds a request expectation object after
properties are set.
Concurrency notes. Builder instances are used in a single thread that
prepares requests expectations - typically main thread.
Implementations are not required to be thread safe.
| Modifier and Type | Method and Description |
|---|---|
RequestExpectationBuilder |
andResponse(ResponseBuilder responseBuilder)
Specifies response builder to provide a response on the actual request.
|
RequestExpectation |
build()
Builds request expectation.
|
ResponseBuilder |
getResponseBuilder()
Gets response builder to provide a response on the actual request.
|
RequestExpectationBuilder |
withBody(ValueExpectation valueExpectation)
Specifies expected request body.
|
RequestExpectationBuilder |
withHeader(String headerName)
Specifies expected request header without any expectations on its value.
|
RequestExpectationBuilder |
withHeader(String headerName,
int valueIndex,
ValueExpectation valueExpectation)
Specifies expected request header with its value and position in the list
of header values.
|
RequestExpectationBuilder |
withHeader(String headerName,
ValueExpectation valueExpectation)
Specifies expected request header with its value, but without position in
the list of header values.
|
RequestExpectationBuilder |
withMethod(ValueExpectation valueExpectation)
Specifies expected request method.
|
RequestExpectationBuilder |
withoutHeader(String headerName)
Specifies that request is not expected to have this header.
|
RequestExpectationBuilder |
withPath(ValueExpectation valueExpectation)
Specifies expected request path.
|
RequestExpectationBuilder |
withStrictHeaders()
If the property
strict headers is enabled, this expectation
allows only headers specified explicitly by withHeader(java.lang.String) method. |
RequestExpectation build()
ResponseBuilder getResponseBuilder()
RequestExpectationBuilder withMethod(ValueExpectation valueExpectation)
valueExpectation - Expected method.NullPointerException - valueExpectation is null.RequestExpectationBuilder withPath(ValueExpectation valueExpectation)
valueExpectation - Expected path.NullPointerException - valueExpectation is null.RequestExpectationBuilder withBody(ValueExpectation valueExpectation)
valueExpectation - Expected body.NullPointerException - valueExpectation is null.RequestExpectationBuilder withHeader(String headerName)
headerName - Header name.NullPointerException - headerName is null.IllegalArgumentException - headerName is empty or blank.RequestExpectationBuilder withHeader(String headerName, ValueExpectation valueExpectation)
headerName - Header name.valueExpectation - Expected header value.NullPointerException - valueExpectation is null.NullPointerException - headerName is null.IllegalArgumentException - headerName is empty or blank.RequestExpectationBuilder withHeader(String headerName, int valueIndex, ValueExpectation valueExpectation)
headerName - Header name.valueIndex - Header value index in the list of header values.valueExpectation - Expected header value.NullPointerException - valueExpectation is null.NullPointerException - headerName is null.IllegalArgumentException - headerName is empty or blank.IllegalArgumentException - valueIndex is negative.RequestExpectationBuilder withoutHeader(String headerName)
headerName - Header name.NullPointerException - headerName is null.IllegalArgumentException - headerName is empty or blank.RequestExpectationBuilder withStrictHeaders()
strict headers is enabled, this expectation
allows only headers specified explicitly by withHeader(java.lang.String) method.
By default this property is disabled.
RequestExpectationBuilder andResponse(ResponseBuilder responseBuilder)
responseBuilder - Response builder.NullPointerException - responseBuilder is null.Copyright © 2016. All rights reserved.