Merge branch '2.2.x'

This commit is contained in:
Marcin Grzejszczak
2020-12-10 14:02:42 +01:00
2 changed files with 13 additions and 3 deletions

View File

@@ -123,7 +123,7 @@ class WireMockResponseStubStrategy extends BaseWireMockStubStrategy {
}
Closure parsingClosureForContentType() {
return contractMetadata.getDefinedOutputTestContentType().contains("/stream") ? Closure.IDENTITY : MapConverter.JSON_PARSING_CLOSURE;
return contractMetadata.getDefinedOutputStubContentType().contains("/stream") ? Closure.IDENTITY : MapConverter.JSON_PARSING_CLOSURE;
}
private void appendResponseDelayTime(ResponseDefinitionBuilder builder) {

View File

@@ -45,7 +45,12 @@ class WireMockResponseStubStrategySpec extends Specification {
when:
SingleContractMetadata metadata = Stub()
metadata.evaluatedOutputStubContentType >> ContentType.JSON
def subject = new WireMockResponseStubStrategy(contract, metadata)
def subject = new WireMockResponseStubStrategy(contract, metadata) {
@Override
protected Closure parsingClosureForContentType() {
return MapConverter.JSON_PARSING_CLOSURE
}
}
def content = subject.buildClientResponseContent()
then:
'{"value":1.5}' == content.body
@@ -73,7 +78,12 @@ class WireMockResponseStubStrategySpec extends Specification {
when:
SingleContractMetadata metadata = Stub()
metadata.evaluatedOutputStubContentType >> ContentType.JSON
def subject = new WireMockResponseStubStrategy(contract, metadata)
def subject = new WireMockResponseStubStrategy(contract, metadata) {
@Override
protected Closure parsingClosureForContentType() {
return MapConverter.JSON_PARSING_CLOSURE
}
}
def content = subject.buildClientResponseContent()
then:
Map body = new JsonSlurper().parseText(content.body) as Map