Package au.com.dius.pact.consumer.kotlin
Class ConsumerPactDsl
-
- All Implemented Interfaces:
public final class ConsumerPactDslReceiver for the top-level pact DSL block. Accumulates interactions and pact-level settings.
-
-
Constructor Summary
Constructors Constructor Description ConsumerPactDsl(String consumer, String provider)
-
Method Summary
Modifier and Type Method Description final UnitusingPlugin(String name, String version)Enables a Pact plugin by name. final UnitaddMetadata(String key, String value)Adds an entry to the metadata section of the Pact file. final Unitcomment(String comment)Adds a text comment. final Unitgiven(String state, Map<String, Object> params)Describes the provider state required for the next interaction. final Unitgiven(String state, Pair<String, Object> params)Describes the provider state required for the next interaction with key/value parameters. final UnituponReceiving(String description, Function1<HttpInteractionDsl, Unit> block)Defines an HTTP interaction using a BDD-style description. final Unitinteraction(String description, Function1<HttpInteractionDsl, Unit> block)Defines an HTTP interaction. -
-
Method Detail
-
usingPlugin
final Unit usingPlugin(String name, String version)
Enables a Pact plugin by name. Optionally pins a specific version.
-
addMetadata
final Unit addMetadata(String key, String value)
Adds an entry to the metadata section of the Pact file.
-
comment
final Unit comment(String comment)
Adds a text comment. The comment is attached to the next interaction.
-
given
final Unit given(String state, Map<String, Object> params)
Describes the provider state required for the next interaction. May be called multiple times. Parameters will be applied to the next uponReceiving or interaction block.
-
given
final Unit given(String state, Pair<String, Object> params)
Describes the provider state required for the next interaction with key/value parameters.
-
uponReceiving
final Unit uponReceiving(String description, Function1<HttpInteractionDsl, Unit> block)
Defines an HTTP interaction using a BDD-style description. Equivalent to interaction.
-
interaction
final Unit interaction(String description, Function1<HttpInteractionDsl, Unit> block)
Defines an HTTP interaction. The block configures the expected request and response.
-
-
-
-