public class MessagePactBuilder
PACT DSL builder for v3 specification
public static au.com.dius.pact.consumer.MessagePactBuilder.Companion Companion
public MessagePactBuilder(@NotNull
au.com.dius.pact.core.model.Consumer consumer,
@NotNull
au.com.dius.pact.core.model.Provider provider,
@NotNull
java.util.List<au.com.dius.pact.core.model.ProviderState> providerStates,
@NotNull
java.util.List<au.com.dius.pact.core.model.messaging.Message> messages)
PACT DSL builder for v3 specification
consumer - The consumer for the pact.provider - The provider for the pact.providerStates - Provider statesmessages - Messages for the pact@NotNull public MessagePactBuilder hasPactWith(@NotNull java.lang.String provider)
Name the provider that the consumer has a pact with.
provider - provider name@NotNull public MessagePactBuilder given(@NotNull java.lang.String providerState)
Sets the provider state.
providerState - description of the provider state@NotNull public MessagePactBuilder given(@NotNull java.lang.String providerState, @NotNull java.util.Map<java.lang.String,? extends java.lang.Object> params)
Sets the provider state.
providerState - description of the provider stateparams - key/value pairs to describe state@NotNull public MessagePactBuilder given(@NotNull au.com.dius.pact.core.model.ProviderState providerState)
Sets the provider state.
providerState - state of the provider@NotNull public MessagePactBuilder expectsToReceive(@NotNull java.lang.String description)
Adds a message expectation in the pact.
description - message description.@NotNull public MessagePactBuilder withMetadata(@NotNull java.util.Map<java.lang.String,? extends java.lang.Object> metadata)
Adds the expected metadata to the message
@NotNull public MessagePactBuilder withContent(@NotNull DslPart body)
Adds the JSON body as the message content
@NotNull public au.com.dius.pact.core.model.messaging.MessagePact toPact()
Convert this builder into a Pact
@JvmStatic @NotNull public static MessagePactBuilder consumer(@NotNull java.lang.String consumer)
Name the consumer of the pact
consumer - Consumer name