/** * Match a request header. A random example header value will be generated from the provided regular expression. * * @param header Header to match * @param regex Regular expression to match */ public PactDslRequestWithPath matchHeader(String header, String regex) { return matchHeader(header, regex, new Generex(regex).random()); }
/** * Match a request header. A random example header value will be generated from the provided regular expression. * * @param header Header to match * @param regex Regular expression to match */ public PactDslRequestWithPath matchHeader(String header, String regex) { return matchHeader(header, regex, new Generex(regex).random()); }
@Pact(consumer="test_consumer") public PactFragment updateWithTriggeringEventConflict(PactDslWithProvider builder) { return builder .given("test state") .uponReceiving("updateWithTriggeringEventConflict request") .path("/entity/default/" + RequestResponseJsonObjects.aggregateType + "/" + RequestResponseJsonObjects.ENTITY_ID) .method("POST") .matchHeader("Content-Type", "application/json") .body(RequestResponseJsonObjects.makeExpectedUpdateRequestWithTriggeringEvent() ) .willRespondWith() .status(409) .body(RequestResponseJsonObjects.makeDuplicateEventErrorResponse()) .toFragment(); }
@Pact(consumer="test_consumer") public PactFragment createWithId(PactDslWithProvider builder) { return builder .given("test state") .uponReceiving("Create with Id request") .path("/entity/default") .method("POST") .matchHeader("Content-Type", "application/json") .body(RequestResponseJsonObjects.makeExpectedCreateWithIdRequest()) .willRespondWith() .status(200) .body(RequestResponseJsonObjects.makeCreateWithIdResponse()) .toFragment(); }
@Pact(consumer="test_consumer") public PactFragment updateWithOptimisticLockingExceptionFollowingRetry(PactDslWithProvider builder) { return builder .given("test state") .uponReceiving("Update with Optimistic Locking request 2") .path("/entity/default/" + RequestResponseJsonObjects.aggregateType + "/" + RequestResponseJsonObjects.ENTITY_ID) .method("POST") .matchHeader("Content-Type", "application/json") .body(RequestResponseJsonObjects.makeExpectedUpdateRequest()) .willRespondWith() .status(409) .body(RequestResponseJsonObjects.makeOptimisticLockingErrorResponse()) .toFragment(); }
@Pact(consumer="test_consumer") public PactFragment update(PactDslWithProvider builder) { return builder .given("test state") .uponReceiving("Update request") .path("/entity/default/" + RequestResponseJsonObjects.aggregateType + "/" + RequestResponseJsonObjects.ENTITY_ID) .method("POST") .matchHeader("Content-Type", "application/json") .body(RequestResponseJsonObjects.makeExpectedUpdateRequest() ) .willRespondWith() .status(200) .body(RequestResponseJsonObjects.makeCreateResponse()) .toFragment(); }
@Pact(consumer="test_consumer") public PactFragment createWithDuplicateId(PactDslWithProvider builder) { return builder .given("test state") .uponReceiving("Create with DuplicateId request") .path("/entity/default") .method("POST") .matchHeader("Content-Type", "application/json") .body(RequestResponseJsonObjects.makeExpectedCreateWithIdRequest() ) .willRespondWith() .status(409) .body(RequestResponseJsonObjects.makeEntityExistsErrorResponse()) .toFragment(); }
@Pact(consumer="test_consumer") public PactFragment create(PactDslWithProvider builder) { return builder .given("test state") .uponReceiving("Create request") .path("/entity/default") .method("POST") .matchHeader("Content-Type", "application/json") .body(RequestResponseJsonObjects.makeExpectedCreateRequest() ) .willRespondWith() .status(200) .body(RequestResponseJsonObjects.makeCreateResponse()) .toFragment(); }
@Pact(consumer="test_consumer") public PactFragment updateWithOptimisticLockingException(PactDslWithProvider builder) { return builder .given("test state") .uponReceiving("Update with Optimistic Locking request") .path("/entity/default/" + RequestResponseJsonObjects.aggregateType + "/" + RequestResponseJsonObjects.ENTITY_ID) .method("POST") .matchHeader("Content-Type", "application/json") .body(RequestResponseJsonObjects.makeExpectedUpdateRequest() ) .willRespondWith() .status(409) .body(RequestResponseJsonObjects.makeOptimisticLockingErrorResponse()) .toFragment(); } @Pact(consumer="test_consumer")
@Pact(consumer="test_consumer") public PactFragment updateWithTriggeringEvent(PactDslWithProvider builder) { return builder .given("test state") .uponReceiving("updateWithTriggeringEvent request") .path("/entity/default/" + RequestResponseJsonObjects.aggregateType + "/" + RequestResponseJsonObjects.ENTITY_ID) .method("POST") .matchHeader("Content-Type", "application/json") .body(RequestResponseJsonObjects.makeExpectedUpdateRequestWithTriggeringEvent() ) .willRespondWith() .status(200) .body(RequestResponseJsonObjects.makeCreateResponse()) .toFragment(); } @Pact(consumer="test_consumer")