Merge branch '1.2.x'
This commit is contained in:
@@ -173,7 +173,7 @@ abstract class BaseWireMockStubStrategy {
|
||||
Map convertedMap = MapConverter.transformValues(value) {
|
||||
it instanceof GString ? it.toString() : it
|
||||
} as Map
|
||||
return new JSONObject(convertedMap).toString()
|
||||
return new JSONObject(new JsonBuilder(convertedMap).toString())
|
||||
}
|
||||
return new JsonBuilder(value).toString()
|
||||
}
|
||||
|
||||
@@ -14,6 +14,6 @@ public class JsonAssertTests {
|
||||
@Test
|
||||
public void should_compare_big_decimals() {
|
||||
DocumentContext context = JsonPath.parse("{\"foo\": 55534673.56}");
|
||||
assertThatJson(context).field("['foo']").isEqualTo(55534673.57);
|
||||
assertThatJson(context).field("['foo']").isEqualTo(55534673.56);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.springframework.cloud.contract.verifier.dsl.wiremock
|
||||
|
||||
import org.springframework.cloud.contract.spec.Contract
|
||||
import spock.lang.Specification
|
||||
|
||||
class WireMockResponseStubStrategySpec extends Specification {
|
||||
def "should not quote floating point numbers"() {
|
||||
given:
|
||||
def irrelevantStatus = 200
|
||||
def contract = Contract.make {
|
||||
request {
|
||||
}
|
||||
response {
|
||||
status irrelevantStatus
|
||||
body([
|
||||
value: 1.5
|
||||
])
|
||||
}
|
||||
}
|
||||
when:
|
||||
def subject = new WireMockResponseStubStrategy(contract)
|
||||
def content = subject.buildClientResponseContent()
|
||||
then:
|
||||
'{"value":1.5}'.equals(content.body)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user