use of au.com.dius.pact.core.model.annotations.Pact in project pact-jvm by DiUS.
the class V4PactBuilderTest method messageInteraction.
@Pact(consumer = "v4_test_consumer")
V4Pact messageInteraction(PactBuilder builder) {
PactDslJsonBody body = new PactDslJsonBody();
body.stringValue("testParam1", "value1");
body.stringValue("testParam2", "value2");
Map<String, Object> metadata = new HashMap<>();
metadata.put("destination", Matchers.regexp("\\w+\\d+", "X001"));
return builder.usingLegacyMessageDsl().given("SomeProviderState").expectsToReceive("a test message").withMetadata(metadata).withContent(body).toPact();
}
use of au.com.dius.pact.core.model.annotations.Pact in project pact-jvm by DiUS.
the class AsyncMessageTest method createPact.
@Pact(provider = "test_provider", consumer = "test_consumer_v3")
public MessagePact createPact(MessagePactBuilder builder) {
PactDslJsonBody body = new PactDslJsonBody();
body.stringValue("testParam1", "value1");
body.stringValue("testParam2", "value2");
Map<String, Object> metadata = new HashMap<>();
metadata.put("Content-Type", "application/json");
metadata.put("destination", Matchers.regexp("\\w+\\d+", "X001"));
return builder.given("SomeProviderState").expectsToReceive("a test message").withMetadata(metadata).withContent(body).toPact();
}
use of au.com.dius.pact.core.model.annotations.Pact in project pact-jvm by DiUS.
the class AsyncMessageTest method createPact2.
@Pact(provider = "test_provider", consumer = "test_consumer_v3")
public MessagePact createPact2(MessagePactBuilder builder) {
PactDslJsonBody body = new PactDslJsonBody();
body.stringValue("testParam1", "value3");
body.stringValue("testParam2", "value4");
Map<String, String> metadata = new HashMap<String, String>();
metadata.put("Content-Type", "application/json");
return builder.given("SomeProviderState2").expectsToReceive("a test message").withMetadata(metadata).withContent(body).toPact();
}
use of au.com.dius.pact.core.model.annotations.Pact in project pact-jvm by DiUS.
the class ExampleMessageConsumerWithRootArrayTest method createPact.
@Pact(provider = "test_provider", consumer = "test_consumer_v3")
public MessagePact createPact(MessagePactBuilder builder) {
PactDslJsonArray body = new PactDslJsonArray().decimalType(100.10).stringType("Should be in an array");
Map<String, String> metadata = new HashMap<String, String>();
metadata.put("contentType", "application/json");
return builder.given("SomeProviderState").expectsToReceive("a test message with an array").withMetadata(metadata).withContent(body).toPact();
}
use of au.com.dius.pact.core.model.annotations.Pact in project pact-jvm by DiUS.
the class ExampleMessageWithMetadataConsumerTest method createPact.
@Pact(provider = "test_provider", consumer = "test_consumer_v3")
public MessagePact createPact(MessagePactBuilder builder) {
PactDslJsonBody body = new PactDslJsonBody();
body.stringValue("testParam1", "value1");
body.stringValue("testParam2", "value2");
Map<String, String> metadata = new HashMap<>();
metadata.put("metadata1", "metadataValue1");
metadata.put("metadata2", "metadataValue2");
return builder.given("SomeProviderState").expectsToReceive("a test message with metadata").withMetadata(metadata).withContent(body).toPact();
}
Aggregations