WIP
This commit is contained in:
@@ -55,6 +55,8 @@ class JsonToJsonPathsConverter {
|
||||
*/
|
||||
private static final String SIZE_ASSERTION_SYSTEM_PROP = "spring.cloud.contract.verifier.assert.size"
|
||||
|
||||
private static final String WITH_ORDER_ASSERTION_SYSTEM_PROP = "spring.cloud.contract.verifier.assert.with-order"
|
||||
|
||||
private static final Boolean SERVER_SIDE = false
|
||||
private static final Boolean CLIENT_SIDE = true
|
||||
private static final Pattern ANY_ARRAY_NOTATION_IN_JSONPATH = ~/\[(.*?)\]/
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.junit.Rule
|
||||
import spock.lang.Issue
|
||||
import spock.lang.Shared
|
||||
import spock.lang.Specification
|
||||
import spock.util.environment.RestoreSystemProperties
|
||||
|
||||
import org.springframework.boot.test.system.OutputCaptureRule
|
||||
import org.springframework.cloud.contract.spec.Contract
|
||||
@@ -1699,6 +1700,76 @@ class MethodBodyBuilderSpec extends Specification implements WireMockStubVerifie
|
||||
}
|
||||
}
|
||||
|
||||
@Issue("#1803")
|
||||
@RestoreSystemProperties
|
||||
def "should work with arrays that have same key-value element [#methodBuilderName]"() {
|
||||
given:
|
||||
System.setProperty('spring.cloud.contract.verifier.assert.size', 'true')
|
||||
Contract contractDsl = Contract.make {
|
||||
description "should return all profiles"
|
||||
|
||||
request {
|
||||
url "/profiles"
|
||||
method GET()
|
||||
}
|
||||
|
||||
response {
|
||||
status OK()
|
||||
headers {
|
||||
contentType applicationJson()
|
||||
}
|
||||
|
||||
body (
|
||||
[
|
||||
[
|
||||
id: 1,
|
||||
name: "Joseph",
|
||||
age: 22,
|
||||
email: "jose@gmail.com",
|
||||
dob: "2000-01-01",
|
||||
a: 1,
|
||||
b: "two"
|
||||
],
|
||||
[
|
||||
id: 2,
|
||||
name: "Sam",
|
||||
age: 32,
|
||||
email: "sam@gmail.com",
|
||||
dob: "2000-01-01",
|
||||
a: 1,
|
||||
b: "two"
|
||||
]
|
||||
]
|
||||
)
|
||||
}
|
||||
}
|
||||
methodBuilder()
|
||||
when:
|
||||
String test = singleTestGenerator(contractDsl)
|
||||
then:
|
||||
SyntaxChecker.tryToCompileWithoutCompileStatic(methodBuilderName, test)
|
||||
!test.contains('''[value:123]''')
|
||||
and:
|
||||
stubMappingIsValidWireMockStub(contractDsl)
|
||||
where:
|
||||
methodBuilderName | methodBuilder
|
||||
"spock" | {
|
||||
properties.testFramework = TestFramework.SPOCK
|
||||
}
|
||||
"mockmvc" | {
|
||||
properties.testMode = TestMode.MOCKMVC
|
||||
}
|
||||
"jaxrs-spock" | {
|
||||
properties.testFramework = TestFramework.SPOCK; properties.testMode = TestMode.JAXRSCLIENT
|
||||
}
|
||||
"jaxrs" | {
|
||||
properties.testFramework = TestFramework.JUNIT; properties.testMode = TestMode.JAXRSCLIENT
|
||||
}
|
||||
"testNG" | {
|
||||
properties.testFramework = TestFramework.TESTNG
|
||||
}
|
||||
}
|
||||
|
||||
@Issue("#1052")
|
||||
def "should work with large numbers [#methodBuilderName]"() {
|
||||
given:
|
||||
|
||||
Reference in New Issue
Block a user