Class HttpInteractionBuilder
-
- All Implemented Interfaces:
public class HttpInteractionBuilderPact HTTP builder DSL that supports V4 formatted Pact files
-
-
Field Summary
Fields Modifier and Type Field Description private final V4Interaction.SynchronousHttpinteraction
-
Constructor Summary
Constructors Constructor Description HttpInteractionBuilder(String description, List<ProviderState> providerStates, List<JsonValue.StringValue> comments)
-
Method Summary
Modifier and Type Method Description final V4Interaction.SynchronousHttpgetInteraction()final V4Interactionbuild()final HttpInteractionBuilderwithRequest(Function1<HttpRequestBuilder, HttpRequestBuilder> builderFn)Build the request part of the interaction using a request builder final HttpInteractionBuilderwillRespondWith(Function1<HttpResponseBuilder, HttpResponseBuilder> builderFn)Build the response part of the interaction using a response builder final HttpInteractionBuilderkey(String key)Sets the unique key for the interaction. final HttpInteractionBuilderdescription(String description)Sets the interaction description final HttpInteractionBuilderstate(String stateDescription, Map<String, Object> params)Adds a provider state to the interaction. final HttpInteractionBuilderstate(String stateDescription)Adds a provider state to the interaction. final HttpInteractionBuilderstate(String stateDescription, String paramKey, Object paramValue)Adds a provider state to the interaction with a parameter. final HttpInteractionBuilderstate(String stateDescription, Pair<String, Object> params)Adds a provider state to the interaction with parameters a pairs of key/values. final HttpInteractionBuilderpending(Boolean pending)Marks the interaction as pending. final HttpInteractionBuildercomment(String comment)Adds a text comment to the interaction final HttpInteractionBuilderreference(String group, String name, Object value)Adds an external reference for the interaction. -
-
Method Detail
-
getInteraction
final V4Interaction.SynchronousHttp getInteraction()
-
build
final V4Interaction build()
-
withRequest
final HttpInteractionBuilder withRequest(Function1<HttpRequestBuilder, HttpRequestBuilder> builderFn)
Build the request part of the interaction using a request builder
-
willRespondWith
final HttpInteractionBuilder willRespondWith(Function1<HttpResponseBuilder, HttpResponseBuilder> builderFn)
Build the response part of the interaction using a response builder
-
key
final HttpInteractionBuilder key(String key)
Sets the unique key for the interaction. If this is not set, or is empty, a key will be calculated from the contents of the interaction.
-
description
final HttpInteractionBuilder description(String description)
Sets the interaction description
-
state
@JvmOverloads() final HttpInteractionBuilder state(String stateDescription, Map<String, Object> params)
Adds a provider state to the interaction.
-
state
@JvmOverloads() final HttpInteractionBuilder state(String stateDescription)
Adds a provider state to the interaction.
-
state
final HttpInteractionBuilder state(String stateDescription, String paramKey, Object paramValue)
Adds a provider state to the interaction with a parameter.
-
state
final HttpInteractionBuilder state(String stateDescription, Pair<String, Object> params)
Adds a provider state to the interaction with parameters a pairs of key/values.
-
pending
final HttpInteractionBuilder pending(Boolean pending)
Marks the interaction as pending.
-
comment
final HttpInteractionBuilder comment(String comment)
Adds a text comment to the interaction
-
reference
final HttpInteractionBuilder reference(String group, String name, Object value)
Adds an external reference for the interaction. The reference will be stored in the Pact file comments under the group key. For instance, you could store the OpenAPI operation ID that the interaction corresponds to as an external reference.
-
-
-
-