use of au.com.dius.pact.core.model.messaging.MessagePact 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();
}
use of au.com.dius.pact.core.model.messaging.MessagePact in project pact-jvm by DiUS.
the class PactVerificationsForMultipleFragmentsTest method messagePact.
@Pact(provider = MESSAGE_PROVIDER_NAME, consumer = PACT_VERIFICATIONS_CONSUMER_NAME)
public MessagePact messagePact(MessagePactBuilder builder) {
PactDslJsonBody body = new PactDslJsonBody();
body.stringValue("testParam1", "value1");
Map<String, String> metadata = new HashMap<String, String>();
metadata.put("contentType", "application/json");
return builder.given("SomeProviderState").expectsToReceive("a test message").withMetadata(metadata).withContent(body).toPact();
}
use of au.com.dius.pact.core.model.messaging.MessagePact in project pact-jvm by DiUS.
the class PactVerificationsForMultipleHttpsAndMessagesTest method otherMessagePact.
@Pact(provider = OTHER_MESSAGE_PROVIDER_NAME, consumer = PACT_VERIFICATIONS_CONSUMER_NAME)
public MessagePact otherMessagePact(MessagePactBuilder builder) {
PactDslJsonBody body = new PactDslJsonBody();
body.stringValue("testParamA", "valueA");
Map<String, String> metadata = new HashMap<String, String>();
metadata.put("contentType", "application/json");
return builder.given("SomeOtherProviderState").expectsToReceive("another test message").withMetadata(metadata).withContent(body).toPact();
}
use of au.com.dius.pact.core.model.messaging.MessagePact in project pact-jvm by DiUS.
the class MessageWithMetadataConsumerTest method createPact.
@Pact(consumer = "test_consumer_v3")
public MessagePact createPact(MessagePactBuilder builder) {
PactDslJsonBody body = new PactDslJsonBody();
body.stringValue("testParam1", "value1");
body.stringValue("testParam2", "value2");
return builder.given("SomeProviderState").expectsToReceive("a test message with metadata").withMetadata(md -> {
md.add("metadata1", "metadataValue1");
md.add("metadata2", "metadataValue2");
md.add("metadata3", 10L);
md.matchRegex("partitionKey", "[A-Z]{3}\\d{2}", "ABC01");
}).withContent(body).toPact();
}
use of au.com.dius.pact.core.model.messaging.MessagePact in project pact-jvm by DiUS.
the class Defect371Test method createPact2.
@Pact(provider = "provider2", consumer = "Defect371")
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("contentType", "application/json");
return builder.given("Some Other Provider State").expectsToReceive("a test message").withMetadata(metadata).withContent(body).toPact();
}
Aggregations