Merge branch '1.1.x'

This commit is contained in:
Marcin Grzejszczak
2017-09-28 14:40:46 +02:00
4 changed files with 65 additions and 3 deletions

View File

@@ -15,7 +15,7 @@
<description>Spring Cloud Contract Dependencies</description>
<properties>
<wiremock.version>2.8.0</wiremock.version>
<jsonassert.version>0.4.9</jsonassert.version>
<jsonassert.version>0.4.10</jsonassert.version>
<aether.version>1.0.2.v20150114</aether.version>
</properties>
<dependencyManagement>

View File

@@ -63,7 +63,7 @@
<dependency>
<groupId>com.toomuchcoding.jsonassert</groupId>
<artifactId>jsonassert</artifactId>
<version>0.4.9</version>
<version>0.4.10</version>
<scope>test</scope>
</dependency>
<dependency>

View File

@@ -62,7 +62,7 @@
<dependency>
<groupId>com.toomuchcoding.jsonassert</groupId>
<artifactId>jsonassert</artifactId>
<version>0.4.9</version>
<version>0.4.10</version>
<scope>test</scope>
</dependency>
<dependency>

View File

@@ -1880,7 +1880,69 @@ class WireMockGroovyDslSpec extends Specification implements WireMockStubVerifie
''', wireMockStub)
and:
stubMappingIsValidWireMockStub(wireMockStub)
}
@Issue('#427')
def "should not fail to generate a stub when arrays are there in the request"() {
given:
Contract groovyDsl = Contract.make {
request {
method "POST"
urlPath('/batch/persons')
body("""
[{
"fruitsILike": [
"apple"
]
},
{
"fruitsILike": [
]
},
{
"fruitsILike": [
"orange"
]
}]
""")
}
response {
status 201
headers {
contentType(applicationJsonUtf8())
}
body("""{
"id": "foo"
}"
""")
}
}
when:
String wireMockStub = new WireMockStubStrategy("Test", new ContractMetadata(null, false, 0, null, groovyDsl), groovyDsl).toWireMockClientStub()
then:
AssertionUtil.assertThatJsonsAreEqual('''
{
"request" : {
"urlPath" : "/batch/persons",
"method" : "POST",
"bodyPatterns" : [ {
"matchesJsonPath" : "$[*].['fruitsILike'][?(@ == 'orange')]"
}, {
"matchesJsonPath" : "$[*].['fruitsILike'][?(@ == 'apple')]"
} ]
},
"response" : {
"status" : 201,
"body" : "{\\"id\\":\\"foo\\"}",
"headers" : {
"Content-Type" : "application/json;charset=UTF-8"
},
"transformers" : [ "response-template" ]
}
}
''', wireMockStub)
and:
stubMappingIsValidWireMockStub(wireMockStub)
}
@Issue('#385')