From 4ddec001305d60736d1d2af6b3bfd8ec48c55746 Mon Sep 17 00:00:00 2001
From: buildmaster
Date: Wed, 26 Apr 2017 10:58:39 +0000
Subject: [PATCH] Sync docs from master to gh-pages
---
spring-cloud-contract.html | 50 ++++++++++++++++++++++----------------
1 file changed, 29 insertions(+), 21 deletions(-)
diff --git a/spring-cloud-contract.html b/spring-cloud-contract.html
index 3c9ae228c6..551d544bf0 100644
--- a/spring-cloud-contract.html
+++ b/spring-cloud-contract.html
@@ -1070,7 +1070,7 @@ org.springframework.cloud.contract.spec.Contract.make {
method 'PUT' // (2)
url '/fraudcheck' // (3)
body([ // (4)
- clientId: $(regex('[0-9]{10}')),
+ "client.id": $(regex('[0-9]{10}')),
loanAmount: 99999
])
headers { // (5)
@@ -1081,7 +1081,7 @@ org.springframework.cloud.contract.spec.Contract.make {
status 200 // (7)
body([ // (8)
fraudCheckStatus: "FRAUD",
- rejectionReason: "Amount too high"
+ "rejection.reason": "Amount too high"
])
headers { // (9)
contentType('application/json')
@@ -1178,7 +1178,7 @@ public void validate_shouldMarkClientAsFraud() throws Exception {
// given:
MockMvcRequestSpecification request = given()
.header("Content-Type", "application/vnd.fraud.v1+json")
- .body("{\"clientPesel\":\"1234567890\",\"loanAmount\":99999}");
+ .body("{\"client.id\":\"1234567890\",\"loanAmount\":99999}");
// when:
ResponseOptions response = given().spec(request)
@@ -1189,8 +1189,8 @@ public void validate_shouldMarkClientAsFraud() throws Exception {
assertThat(response.header("Content-Type")).matches("application/vnd.fraud.v1.json.*");
// and:
DocumentContext parsedJson = JsonPath.parse(response.getBody().asString());
- assertThatJson(parsedJson).field("fraudCheckStatus").matches("[A-Z]{5}");
- assertThatJson(parsedJson).field("rejectionReason").isEqualTo("Amount too high");
+ assertThatJson(parsedJson).field("['fraudCheckStatus']").matches("[A-Z]{5}");
+ assertThatJson(parsedJson).field("['rejection.reason']").isEqualTo("Amount too high");
}
@@ -1389,7 +1389,7 @@ org.springframework.cloud.contract.spec.Contract.make {
method 'PUT' // (2)
url '/fraudcheck' // (3)
body([ // (4)
- clientId: $(regex('[0-9]{10}')),
+ "client.id": $(regex('[0-9]{10}')),
loanAmount: 99999
])
headers { // (5)
@@ -1400,7 +1400,7 @@ org.springframework.cloud.contract.spec.Contract.make {
status 200 // (7)
body([ // (8)
fraudCheckStatus: "FRAUD",
- rejectionReason: "Amount too high"
+ "rejection.reason": "Amount too high"
])
headers { // (9)
contentType('application/json')
@@ -1477,7 +1477,7 @@ It’s really important that you understand the map notation to set up contr
a method PUT on an endpoint /fraudcheck
-JSON body with clientPesel matching the regular expression [0-9]{10} and loanAmount equal to 99999
+JSON body with client.id matching the regular expression [0-9]{10} and loanAmount equal to 99999
and with a header Content-Type equal to application/vnd.fraud.v1+json
@@ -1800,7 +1800,7 @@ public void validate_shouldMarkClientAsFraud() throws Exception {
// given:
MockMvcRequestSpecification request = given()
.header("Content-Type", "application/vnd.fraud.v1+json")
- .body("{\"clientPesel\":\"1234567890\",\"loanAmount\":99999}");
+ .body("{\"client.id\":\"1234567890\",\"loanAmount\":99999}");
// when:
ResponseOptions response = given().spec(request)
@@ -1811,8 +1811,8 @@ public void validate_shouldMarkClientAsFraud() throws Exception {
assertThat(response.header("Content-Type")).matches("application/vnd.fraud.v1.json.*");
// and:
DocumentContext parsedJson = JsonPath.parse(response.getBody().asString());
- assertThatJson(parsedJson).field("fraudCheckStatus").matches("[A-Z]{5}");
- assertThatJson(parsedJson).field("rejectionReason").isEqualTo("Amount too high");
+ assertThatJson(parsedJson).field("['fraudCheckStatus']").matches("[A-Z]{5}");
+ assertThatJson(parsedJson).field("['rejection.reason']").isEqualTo("Amount too high");
}
@@ -6656,7 +6656,7 @@ String nonBlank() {
response.header('Content-Type') == 'application/json'
and:
DocumentContext parsedJson = JsonPath.parse(response.body.asString())
- assertThatJson(parsedJson).field("code").matches("(123123)?")
+ assertThatJson(parsedJson).field("['code']").matches("(123123)?")
"""
@@ -6671,9 +6671,9 @@ String nonBlank() {
"url" : "/users/password",
"method" : "POST",
"bodyPatterns" : [ {
- "matchesJsonPath" : "$[?(@.email =~ /([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\\\.[a-zA-Z]{2,4})?/)]"
+ "matchesJsonPath" : "$[?(@.['email'] =~ /([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\\\.[a-zA-Z]{2,4})?/)]"
}, {
- "matchesJsonPath" : "$[?(@.callback_url =~ /((http[s]?|ftp):\\\\/)\\\\/?([^:\\\\/\\\\s]+)(:[0-9]{1,5})?/)]"
+ "matchesJsonPath" : "$[?(@.['callback_url'] =~ /((http[s]?|ftp):\\\\/)\\\\/?([^:\\\\/\\\\s]+)(:[0-9]{1,5})?/)]"
} ],
"headers" : {
"Content-Type" : {
@@ -7044,7 +7044,10 @@ will result in calling a foo method to which the value matching the
dateTime: "2017-01-01T01:23:45",
time: "01:02:34",
valueWithoutAMatcher: "foo",
- valueWithTypeMatch: "string"
+ valueWithTypeMatch: "string",
+ key: [
+ 'complex.key' : 'foo'
+ ]
])
stubMatchers {
jsonPath('$.duck', byRegex("[0-9]{3}"))
@@ -7056,6 +7059,7 @@ will result in calling a foo method to which the value matching the
jsonPath('$.date', byDate())
jsonPath('$.dateTime', byTimestamp())
jsonPath('$.time', byTime())
+ jsonPath("\$.['key'].['complex.key']", byEquality())
}
headers {
contentType(applicationJson())
@@ -7084,6 +7088,9 @@ will result in calling a foo method to which the value matching the
],
valueWithMinEmpty: [],
valueWithMaxEmpty: [],
+ key: [
+ 'complex.key' : 'foo'
+ ]
])
testMatchers {
// asserts the jsonpath value against manual regex
@@ -7124,6 +7131,7 @@ will result in calling a foo method to which the value matching the
})
// will execute a method `assertThatValueIsANumber`
jsonPath('$.duck', byCommand('assertThatValueIsANumber($it)'))
+ jsonPath("\$.['key'].['complex.key']", byEquality())
}
headers {
contentType(applicationJson())
@@ -7222,15 +7230,15 @@ assertions and the one from matchers with an and section):
}
},
"bodyPatterns" : [ {
- "matchesJsonPath" : "$[?(@.valueWithoutAMatcher == 'foo')]"
+ "matchesJsonPath" : "$[?(@.['valueWithoutAMatcher'] == 'foo')]"
}, {
- "matchesJsonPath" : "$[?(@.valueWithTypeMatch == 'string')]"
+ "matchesJsonPath" : "$[?(@.['valueWithTypeMatch'] == 'string')]"
}, {
- "matchesJsonPath" : "$.list.some.nested[?(@.anothervalue == 4)]"
+ "matchesJsonPath" : "$.['list'].['some'].['nested'][?(@.['anothervalue'] == 4)]"
}, {
- "matchesJsonPath" : "$.list.someother.nested[?(@.anothervalue == 4)]"
+ "matchesJsonPath" : "$.['list'].['someother'].['nested'][?(@.['anothervalue'] == 4)]"
}, {
- "matchesJsonPath" : "$.list.someother.nested[?(@.json == 'with value')]"
+ "matchesJsonPath" : "$.['list'].['someother'].['nested'][?(@.['json'] == 'with value')]"
}, {
"matchesJsonPath" : "$[?(@.duck =~ /([0-9]{3})/)]"
}, {
@@ -7308,7 +7316,7 @@ assertions and the one from matchers with an and section):
assertThat(response.getStatus()).isEqualTo(200);
// and:
DocumentContext parsedJson = JsonPath.parse(responseAsString);
- assertThatJson(parsedJson).field("property1").isEqualTo("a");
+ assertThatJson(parsedJson).field("['property1']").isEqualTo("a");
'''