-
public final class MessagePactBuilder
PACT DSL builder for v3 specification
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public class
MessagePactBuilder.Companion
-
Constructor Summary
Constructors Constructor Description MessagePactBuilder(Consumer consumer, Provider provider, List<ProviderState> providerStates, List<Message> messages)
-
Method Summary
Modifier and Type Method Description final MessagePactBuilder
hasPactWith(String provider)
Name the provider that the consumer has a pact with. final MessagePactBuilder
given(String providerState)
Sets the provider state. final MessagePactBuilder
given(String providerState, Map<String, Object> params)
Sets the provider state. final MessagePactBuilder
given(ProviderState providerState)
Sets the provider state. final MessagePactBuilder
expectsToReceive(String description)
Adds a message expectation in the pact. final MessagePactBuilder
withMetadata(Map<String, Object> metadata)
Adds the expected metadata to the message final MessagePactBuilder
withContent(DslPart body)
Adds the JSON body as the message content final MessagePactBuilder
withContent(PactXmlBuilder xmlBuilder)
Adds the XML body as the message content final <P extends Pact> P
toPact(Class<P> pactClass)
Terminates the DSL and builds a pact to represent the interactions final <P extends Pact> P
toPact()
Convert this builder into a Pact -
-
Method Detail
-
hasPactWith
final MessagePactBuilder hasPactWith(String provider)
Name the provider that the consumer has a pact with.
- Parameters:
provider
- provider name
-
given
final MessagePactBuilder given(String providerState)
Sets the provider state.
- Parameters:
providerState
- description of the provider state
-
given
final MessagePactBuilder given(String providerState, Map<String, Object> params)
Sets the provider state.
- Parameters:
providerState
- description of the provider stateparams
- key/value pairs to describe state
-
given
final MessagePactBuilder given(ProviderState providerState)
Sets the provider state.
- Parameters:
providerState
- state of the provider
-
expectsToReceive
final MessagePactBuilder expectsToReceive(String description)
Adds a message expectation in the pact.
- Parameters:
description
- message description.
-
withMetadata
final MessagePactBuilder withMetadata(Map<String, Object> metadata)
Adds the expected metadata to the message
-
withContent
final MessagePactBuilder withContent(DslPart body)
Adds the JSON body as the message content
-
withContent
final MessagePactBuilder withContent(PactXmlBuilder xmlBuilder)
Adds the XML body as the message content
-
toPact
final <P extends Pact> P toPact(Class<P> pactClass)
Terminates the DSL and builds a pact to represent the interactions
-
-
-
-