Class SynchronousMessagePactBuilder
-
- All Implemented Interfaces:
public final class SynchronousMessagePactBuilderPACT DSL builder for v4 specification synchronous request/response messages
-
-
Constructor Summary
Constructors Constructor Description SynchronousMessagePactBuilder(PactSpecVersion specVersion)SynchronousMessagePactBuilder(Consumer consumer, Provider provider, List<ProviderState> providerStates, List<V4Interaction.SynchronousMessages> messages, PactSpecVersion specVersion)SynchronousMessagePactBuilder(Consumer consumer, Provider provider, List<ProviderState> providerStates, List<V4Interaction.SynchronousMessages> messages)SynchronousMessagePactBuilder(Consumer consumer, Provider provider, List<ProviderState> providerStates)SynchronousMessagePactBuilder(Consumer consumer, Provider provider)SynchronousMessagePactBuilder(Consumer consumer)SynchronousMessagePactBuilder()
-
Method Summary
Modifier and Type Method Description final SynchronousMessagePactBuilderconsumer(String consumer)Name the consumer of the pact final SynchronousMessagePactBuilderhasPactWith(String provider)Name the provider that the consumer has a pact with. final SynchronousMessagePactBuildergiven(String providerState)Sets the provider state. final SynchronousMessagePactBuildergiven(String providerState, Map<String, Object> params)Sets the provider state. final SynchronousMessagePactBuildergiven(ProviderState providerState)Sets the provider state. final SynchronousMessagePactBuilderpending(Boolean pending)Marks the interaction as pending. final SynchronousMessagePactBuildercomment(String comment)Adds a text comment to the interaction final SynchronousMessagePactBuilderreference(String group, String name, Object value)Adds an external reference for the interaction. final SynchronousMessagePactBuilderkey(String key)Sets the unique key for the interaction. final SynchronousMessagePactBuilderexpectsToReceive(String description)Adds a message expectation to the pact. final SynchronousMessagePactBuilderwithRequest(Consumer<MessageContentsBuilder> callback)Adds the expected request message to the interaction final SynchronousMessagePactBuilderwithResponse(Consumer<MessageContentsBuilder> callback)Adds the expected response message to the interaction. final <P extends Pact> PtoPact(Class<P> pactClass)Terminates the DSL and builds a pact to represent the interactions final V4PacttoPact()Convert this builder into a Pact -
-
Constructor Detail
-
SynchronousMessagePactBuilder
SynchronousMessagePactBuilder(PactSpecVersion specVersion)
-
SynchronousMessagePactBuilder
SynchronousMessagePactBuilder(Consumer consumer, Provider provider, List<ProviderState> providerStates, List<V4Interaction.SynchronousMessages> messages, PactSpecVersion specVersion)
-
SynchronousMessagePactBuilder
SynchronousMessagePactBuilder(Consumer consumer, Provider provider, List<ProviderState> providerStates, List<V4Interaction.SynchronousMessages> messages)
-
SynchronousMessagePactBuilder
SynchronousMessagePactBuilder(Consumer consumer, Provider provider, List<ProviderState> providerStates)
-
SynchronousMessagePactBuilder
SynchronousMessagePactBuilder(Consumer consumer, Provider provider)
-
SynchronousMessagePactBuilder
SynchronousMessagePactBuilder(Consumer consumer)
-
SynchronousMessagePactBuilder
SynchronousMessagePactBuilder()
-
-
Method Detail
-
consumer
final SynchronousMessagePactBuilder consumer(String consumer)
Name the consumer of the pact
- Parameters:
consumer- Consumer name
-
hasPactWith
final SynchronousMessagePactBuilder hasPactWith(String provider)
Name the provider that the consumer has a pact with.
- Parameters:
provider- provider name- Returns:
this builder.
-
given
final SynchronousMessagePactBuilder given(String providerState)
Sets the provider state.
- Parameters:
providerState- description of the provider state- Returns:
this builder.
-
given
final SynchronousMessagePactBuilder given(String providerState, Map<String, Object> params)
Sets the provider state.
- Parameters:
providerState- description of the provider stateparams- key/value pairs to describe state- Returns:
this builder.
-
given
final SynchronousMessagePactBuilder given(ProviderState providerState)
Sets the provider state.
- Parameters:
providerState- state of the provider- Returns:
this builder.
-
pending
final SynchronousMessagePactBuilder pending(Boolean pending)
Marks the interaction as pending.
-
comment
final SynchronousMessagePactBuilder comment(String comment)
Adds a text comment to the interaction
-
reference
final SynchronousMessagePactBuilder 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.
-
key
final SynchronousMessagePactBuilder 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.
-
expectsToReceive
final SynchronousMessagePactBuilder expectsToReceive(String description)
Adds a message expectation to the pact.
- Parameters:
description- message description.
-
withRequest
final SynchronousMessagePactBuilder withRequest(Consumer<MessageContentsBuilder> callback)
Adds the expected request message to the interaction
-
withResponse
final SynchronousMessagePactBuilder withResponse(Consumer<MessageContentsBuilder> callback)
Adds the expected response message to the interaction. Calling this multiple times will add a new response message for each call.
-
toPact
final <P extends Pact> P toPact(Class<P> pactClass)
Terminates the DSL and builds a pact to represent the interactions
-
toPact
final V4Pact toPact()
Convert this builder into a Pact
-
-
-
-