Class SynchronousMessageInteractionBuilder
-
- All Implemented Interfaces:
public class SynchronousMessageInteractionBuilderPact Message builder DSL that supports V4 formatted Pact files
-
-
Field Summary
Fields Modifier and Type Field Description private final V4Interaction.SynchronousMessagesinteraction
-
Constructor Summary
Constructors Constructor Description SynchronousMessageInteractionBuilder(String description, List<ProviderState> providerStates, List<JsonValue.StringValue> comments)
-
Method Summary
Modifier and Type Method Description final V4Interaction.SynchronousMessagesgetInteraction()final SynchronousMessageInteractionBuilderkey(String key)Sets the unique key for the interaction. final SynchronousMessageInteractionBuilderdescription(String description)Sets the interaction description final SynchronousMessageInteractionBuilderstate(String stateDescription, Map<String, Object> params)Adds a provider state to the interaction. final SynchronousMessageInteractionBuilderstate(String stateDescription)Adds a provider state to the interaction. final SynchronousMessageInteractionBuilderstate(String stateDescription, String paramKey, Object paramValue)Adds a provider state to the interaction with a parameter. final SynchronousMessageInteractionBuilderstate(String stateDescription, Pair<String, Object> params)Adds a provider state to the interaction with parameters a pairs of key/values. final SynchronousMessageInteractionBuilderpending(Boolean pending)Marks the interaction as pending. final SynchronousMessageInteractionBuildercomment(String comment)Adds a text comment to the interaction final SynchronousMessageInteractionBuilderreference(String group, String name, Object value)Adds an external reference for the interaction. final SynchronousMessageInteractionBuilderwithRequest(Function1<MessageContentsBuilder, MessageContentsBuilder> builderFn)Build the request part of the interaction using a contents builder final SynchronousMessageInteractionBuilderwillRespondWith(Function1<MessageContentsBuilder, MessageContentsBuilder> builderFn)Build the response part of the interaction using a response builder. final V4Interactionbuild()-
-
Method Detail
-
getInteraction
final V4Interaction.SynchronousMessages getInteraction()
-
key
final SynchronousMessageInteractionBuilder 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 SynchronousMessageInteractionBuilder description(String description)
Sets the interaction description
-
state
@JvmOverloads() final SynchronousMessageInteractionBuilder state(String stateDescription, Map<String, Object> params)
Adds a provider state to the interaction.
-
state
@JvmOverloads() final SynchronousMessageInteractionBuilder state(String stateDescription)
Adds a provider state to the interaction.
-
state
final SynchronousMessageInteractionBuilder state(String stateDescription, String paramKey, Object paramValue)
Adds a provider state to the interaction with a parameter.
-
state
final SynchronousMessageInteractionBuilder state(String stateDescription, Pair<String, Object> params)
Adds a provider state to the interaction with parameters a pairs of key/values.
-
pending
final SynchronousMessageInteractionBuilder pending(Boolean pending)
Marks the interaction as pending.
-
comment
final SynchronousMessageInteractionBuilder comment(String comment)
Adds a text comment to the interaction
-
reference
final SynchronousMessageInteractionBuilder 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.
-
withRequest
final SynchronousMessageInteractionBuilder withRequest(Function1<MessageContentsBuilder, MessageContentsBuilder> builderFn)
Build the request part of the interaction using a contents builder
-
willRespondWith
final SynchronousMessageInteractionBuilder willRespondWith(Function1<MessageContentsBuilder, MessageContentsBuilder> builderFn)
Build the response part of the interaction using a response builder. This can be called multiple times to add additional response messages.
-
build
final V4Interaction build()
-
-
-
-