Fixed broken compilation

This commit is contained in:
Marcin Grzejszczak
2020-12-10 14:00:53 +01:00
parent 2b0ef2f2fc
commit 1bb3516249
2 changed files with 20 additions and 4 deletions

View File

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

View File

@@ -23,6 +23,7 @@ import spock.lang.Specification
import org.springframework.cloud.contract.spec.Contract
import org.springframework.cloud.contract.verifier.file.SingleContractMetadata
import org.springframework.cloud.contract.verifier.util.ContentType
import org.springframework.cloud.contract.verifier.util.MapConverter
class WireMockResponseStubStrategySpec extends Specification {
@@ -44,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
@@ -72,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
@@ -247,6 +258,11 @@ class WireMockResponseStubStrategySpec extends Specification {
protected ContentType contentType(SingleContractMetadata singleContractMetadata) {
return ContentType.JSON
}
@Override
protected Closure parsingClosureForContentType() {
return MapConverter.JSON_PARSING_CLOSURE
}
}
response.buildClientResponseContent()
then: