/** * The body of the request with possible single quotes as delimiters * and using {@link QuoteUtil} to convert single quotes to double quotes if required. * * @param body Request body in string form */ public PactDslRequestWithPath bodyWithSingleQuotes(String body) { if (body != null) { body = QuoteUtil.convert(body); } return body(body); }
/** * The body of the request with possible single quotes as delimiters * and using {@link QuoteUtil} to convert single quotes to double quotes if required. * * @param body Request body in string form */ public PactDslRequestWithPath bodyWithSingleQuotes(String body, ContentType mimeType) { if (body != null) { body = QuoteUtil.convert(body); } return body(body, mimeType); }
/** * The body of the request with possible single quotes as delimiters * and using {@link QuoteUtil} to convert single quotes to double quotes if required. * * @param body Request body in string form */ public PactDslRequestWithPath bodyWithSingleQuotes(String body, String mimeType) { if (body != null) { body = QuoteUtil.convert(body); } return body(body, mimeType); }
/** * The body of the request * * @param body Request body in string form */ public PactDslRequestWithPath body(String body, ContentType mimeType) { return body(body, mimeType.toString()); }
/** * The body of the request with possible single quotes as delimiters * and using {@link QuoteUtil} to convert single quotes to double quotes if required. * * @param body Request body in string form */ public PactDslRequestWithPath bodyWithSingleQuotes(String body, ContentType mimeType) { if (body != null) { body = QuoteUtil.convert(body); } return body(body, mimeType); }
/** * The body of the request * * @param body Request body in Java Functional Interface Supplier that must return a string */ public PactDslRequestWithPath body(Supplier<String> body, ContentType mimeType) { return body(body, mimeType.toString()); }
/** * The body of the request with possible single quotes as delimiters * and using {@link QuoteUtil} to convert single quotes to double quotes if required. * * @param body Request body in string form */ public PactDslRequestWithPath bodyWithSingleQuotes(String body, String mimeType) { if (body != null) { body = QuoteUtil.convert(body); } return body(body, mimeType); }
/** * The body of the request * * @param body Request body in Java Functional Interface Supplier that must return a string */ public PactDslRequestWithPath body(Supplier<String> body, ContentType mimeType) { return body(body, mimeType.toString()); }
/** * The body of the request * * @param body Request body in string form */ public PactDslRequestWithPath body(String body, ContentType mimeType) { return body(body, mimeType.toString()); }
/** * The body of the request with possible single quotes as delimiters * and using {@link QuoteUtil} to convert single quotes to double quotes if required. * * @param body Request body in string form */ public PactDslRequestWithPath bodyWithSingleQuotes(String body) { if (body != null) { body = QuoteUtil.convert(body); } return body(body); }
@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")