From 9a6ff61f825bc0a08fac83403959f7544466dfaa Mon Sep 17 00:00:00 2001
From: buildmaster
Date: Wed, 26 Apr 2017 10:27:52 +0000
Subject: [PATCH] Sync docs from 1.0.x to gh-pages
---
1.0.x/spring-cloud-contract.html | 32 ++++++++++++++++++++------------
1 file changed, 20 insertions(+), 12 deletions(-)
diff --git a/1.0.x/spring-cloud-contract.html b/1.0.x/spring-cloud-contract.html
index b1c8685327..383af1a7c3 100644
--- a/1.0.x/spring-cloud-contract.html
+++ b/1.0.x/spring-cloud-contract.html
@@ -1788,7 +1788,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)
@@ -1799,7 +1799,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/vnd.fraud.v1+json')
@@ -7059,7 +7059,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)?")
"""
@@ -7074,9 +7074,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" : {
@@ -7267,7 +7267,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}"))
@@ -7279,6 +7282,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())
@@ -7307,6 +7311,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
@@ -7347,6 +7354,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())
@@ -7445,15 +7453,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})/)]"
}, {
@@ -7531,7 +7539,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");
'''