1 package de.juplo.demos.consumer.adapter;
3 import au.com.dius.pact.consumer.dsl.PactDslWithProvider;
4 import au.com.dius.pact.consumer.junit5.PactConsumerTestExt;
5 import au.com.dius.pact.consumer.junit5.PactTestFor;
6 import au.com.dius.pact.core.model.RequestResponsePact;
7 import org.junit.jupiter.api.extension.ExtendWith;
10 @ExtendWith(PactConsumerTestExt.class)
11 @PactTestFor(providerName = "UsersProvider")
12 public class RemoteUsersServiceConsumerIT
14 @Pact(provider="UsersProvider", consumer="EmailServicesConsumer")
15 public RequestResponsePact createPact(PactDslWithProvider builder) {
17 .given("User with email pact@juplo.de exists")
18 .uponReceiving("Request for user with email pact@juplo.de")
22 // See: https://stackoverflow.com/a/201378/247276
23 "(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])",
26 .matchHeader("", "", "")
29 .body("{\"responsetest\": true}")