Merge branch '1.1.x'
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user