Class HttpInteractionDsl
-
- All Implemented Interfaces:
public final class HttpInteractionDslReceiver for an interaction or uponReceiving block. Configures a single HTTP interaction.
-
-
Constructor Summary
Constructors Constructor Description HttpInteractionDsl()
-
Method Summary
Modifier and Type Method Description final Unitgiven(String state, Map<String, Object> params)Adds a provider state to this interaction. final Unitgiven(String state, Pair<String, Object> params)Adds a provider state with key/value parameters to this interaction. final Unitpending(Boolean pending)Marks this interaction as pending. final Unitcomment(String comment)Adds a text comment to the interaction. final UnitwithRequest(Function1<HttpRequestBuilder, Unit> block)Configures the expected HTTP request. final UnitwillRespondWith(Function1<HttpResponseBuilder, Unit> block)Configures the expected HTTP response. -
-
Method Detail
-
given
final Unit given(String state, Map<String, Object> params)
Adds a provider state to this interaction. May be called multiple times for multiple states.
-
given
final Unit given(String state, Pair<String, Object> params)
Adds a provider state with key/value parameters to this interaction.
-
pending
final Unit pending(Boolean pending)
Marks this interaction as pending. A pending interaction will not cause provider verification to fail.
-
withRequest
final Unit withRequest(Function1<HttpRequestBuilder, Unit> block)
Configures the expected HTTP request. The block receives an HttpRequestBuilder as its receiver, giving access to HttpRequestBuilder.method, HttpRequestBuilder.path, HttpRequestBuilder.header, HttpRequestBuilder.queryParameter, HttpRequestBuilder.body, and more.
-
willRespondWith
final Unit willRespondWith(Function1<HttpResponseBuilder, Unit> block)
Configures the expected HTTP response. The block receives an HttpResponseBuilder as its receiver, giving access to HttpResponseBuilder.status, HttpResponseBuilder.header, HttpResponseBuilder.body, and semantic status matchers like HttpResponseBuilder.successStatus.
-
-
-
-