Java 16 workarounds - continued

This commit is contained in:
Marcin Grzejszczak
2021-07-14 11:35:55 +02:00
parent 86eb799011
commit 7d9973f3f9
3 changed files with 14 additions and 1 deletions

View File

@@ -93,7 +93,11 @@ public final class MetadataUtil {
return MAPPER.readerForUpdating(objectToMerge).readValue(bytes);
}
catch (Exception e) {
if (e.getClass().toString().contains("InaccessibleObjectException") && patch instanceof Map) {
if (e.getClass().toString().contains("InaccessibleObjectException")) {
// JDK 16 workaround - ObjectMapper seems not be JDK16 compatible
// with the setup present in Spring Cloud Contract. So we will not
// allow patching but we will just copy values from the patch to
// to the object to merge
try {
YamlPropertiesFactoryBean yamlProcessor = new YamlPropertiesFactoryBean();
yamlProcessor.setResources(new ByteArrayResource(bytes));

View File

@@ -18,6 +18,8 @@
package org.springframework.cloud.contract.verifier.builder
import org.junit.Rule
import org.spockframework.runtime.extension.builtin.PreconditionContext
import spock.lang.IgnoreIf
import spock.lang.Issue
import spock.lang.Shared
import spock.lang.Specification
@@ -572,6 +574,7 @@ class MethodBodyBuilderSpec extends Specification implements WireMockStubVerifie
}
@Issue('#458')
@IgnoreIf({ PreconditionContext it -> it.jvm.java16Compatible })
def 'should reference request from body when body is a string [#methodBuilderName]'() {
given:
Contract contractDsl = Contract.make {
@@ -681,6 +684,7 @@ class MethodBodyBuilderSpec extends Specification implements WireMockStubVerifie
}
@Issue('#702')
@IgnoreIf({ PreconditionContext it -> it.jvm.java16Compatible })
def 'should generate proper type for large numbers [#methodBuilderName]'() {
given:
Contract contractDsl = Contract.make {
@@ -2029,6 +2033,7 @@ response:
}
}
@IgnoreIf({ PreconditionContext it -> it.jvm.java16Compatible })
def 'should resolve headers from request correctly'() {
given:
Contract contractDsl = Contract.make {

View File

@@ -19,6 +19,8 @@ package org.springframework.cloud.contract.verifier.builder
import java.util.regex.Pattern
import org.junit.Rule
import org.spockframework.runtime.extension.builtin.PreconditionContext
import spock.lang.IgnoreIf
import spock.lang.Issue
import spock.lang.Shared
import spock.lang.Specification
@@ -2788,6 +2790,7 @@ DocumentContext parsedJson = JsonPath.parse(json);
}
@Issue('#230')
@IgnoreIf({ PreconditionContext it -> it.jvm.java16Compatible })
def 'should manage to reference request in response [#methodBuilderName]'() {
given:
//tag::template_contract[]
@@ -2889,6 +2892,7 @@ DocumentContext parsedJson = JsonPath.parse(json);
}
@Issue('#230')
@IgnoreIf({ PreconditionContext it -> it.jvm.java16Compatible })
def 'should manage to reference request in response via WireMock native entries [#methodBuilderName]'() {
given:
//tag::template_contract[]