Code cleanup.
This commit is contained in:
@@ -18,7 +18,7 @@ package org.springframework.cloud.contract.spec.internal
|
||||
|
||||
import groovy.transform.CompileStatic
|
||||
import groovy.transform.EqualsAndHashCode
|
||||
import groovy.transform.ToString;
|
||||
import groovy.transform.ToString
|
||||
|
||||
/**
|
||||
* Represents a matching strategy for a JSON
|
||||
|
||||
@@ -143,7 +143,7 @@ class RegexPatterns {
|
||||
}
|
||||
|
||||
static String multipartFile(Object name, Object filename, Object content, Object contentType) {
|
||||
return ".*--(.*)\r\nContent-Disposition: form-data; name=\"$name\"; filename=\"$filename\"\r\n(Content-Type: ${toContentType(contentType)}\r\n)?(Content-Transfer-Encoding: .*\r\n)?(Content-Length: \\d+\r\n)?\r\n$content\r\n--\\1.*";
|
||||
return ".*--(.*)\r\nContent-Disposition: form-data; name=\"$name\"; filename=\"$filename\"\r\n(Content-Type: ${toContentType(contentType)}\r\n)?(Content-Transfer-Encoding: .*\r\n)?(Content-Length: \\d+\r\n)?\r\n$content\r\n--\\1.*"
|
||||
}
|
||||
|
||||
private static String toContentType(Object contentType) {
|
||||
|
||||
@@ -65,7 +65,7 @@ class AetherStubDownloaderSpec extends Specification {
|
||||
ResourceUtils.getFile(ResourceUtils.CLASSPATH_URL_PREFIX + m2repoFolder).getAbsolutePath() + '</localRepository></settings>'
|
||||
System.setProperty("org.apache.maven.user-settings", tempSettings.getAbsolutePath())
|
||||
RepositorySystemSession repositorySystemSession =
|
||||
AetherFactories.newSession(AetherFactories.newRepositorySystem(), true);
|
||||
AetherFactories.newSession(AetherFactories.newRepositorySystem(), true)
|
||||
|
||||
and:
|
||||
StubRunnerOptions stubRunnerOptions = new StubRunnerOptionsBuilder()
|
||||
|
||||
@@ -177,23 +177,23 @@ class StubRunnerExecutorSpec extends Specification {
|
||||
private class AssertingStubMessages implements MessageVerifier<Object> {
|
||||
|
||||
@Override
|
||||
public void send(Object message, String destination) {
|
||||
void send(Object message, String destination) {
|
||||
throw new UnsupportedOperationException()
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void send(T payload, Map<String, Object> headers, String destination) {
|
||||
<T> void send(T payload, Map<String, Object> headers, String destination) {
|
||||
assert !(JsonOutput.toJson(payload).contains("serverValue"))
|
||||
assert headers.entrySet().every { !(it.value.toString().contains("serverValue")) }
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object receive(String destination, long timeout, TimeUnit timeUnit) {
|
||||
Object receive(String destination, long timeout, TimeUnit timeUnit) {
|
||||
throw new UnsupportedOperationException()
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object receive(String destination) {
|
||||
Object receive(String destination) {
|
||||
throw new UnsupportedOperationException()
|
||||
}
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@ class StubRunnerRuleSpec extends Specification {
|
||||
@BeforeClass
|
||||
@AfterClass
|
||||
void setupProps() {
|
||||
System.clearProperty("stubrunner.repository.root");
|
||||
System.clearProperty("stubrunner.classifier");
|
||||
System.clearProperty("stubrunner.repository.root")
|
||||
System.clearProperty("stubrunner.classifier")
|
||||
}
|
||||
|
||||
// tag::classrule[]
|
||||
|
||||
@@ -64,8 +64,8 @@ class StubRunnerSpringCloudConsulAutoConfigurationSpec extends Specification {
|
||||
@BeforeClass
|
||||
@AfterClass
|
||||
static void setupProps() {
|
||||
System.clearProperty("stubrunner.stubs.repository.root");
|
||||
System.clearProperty("stubrunner.stubs.classifier");
|
||||
System.clearProperty("stubrunner.stubs.repository.root")
|
||||
System.clearProperty("stubrunner.stubs.classifier")
|
||||
}
|
||||
|
||||
def 'should make service discovery work for #serviceName'() {
|
||||
|
||||
@@ -85,7 +85,7 @@ public abstract class AbstractGitTest {
|
||||
return new GitRepo.JGitFactory().open(project);
|
||||
}
|
||||
|
||||
File clonedProject(File baseDir, File projectToClone) throws IOException {
|
||||
File clonedProject(File baseDir, File projectToClone) {
|
||||
GitRepo projectRepo = new GitRepo(baseDir);
|
||||
projectRepo.cloneProject(projectToClone.toURI());
|
||||
return baseDir;
|
||||
|
||||
@@ -37,7 +37,7 @@ class RecursiveFilesConverterSpec extends Specification {
|
||||
Paths.get("dir1/shouldHaveIndex1.json"), Paths.get("dir1/shouldHaveIndex2.json")]
|
||||
|
||||
@Rule
|
||||
public TemporaryFolder tmpFolder = new TemporaryFolder();
|
||||
public TemporaryFolder tmpFolder = new TemporaryFolder()
|
||||
|
||||
def "should recursively convert all matching files"() {
|
||||
given:
|
||||
|
||||
@@ -44,6 +44,6 @@ class PublishStubsToScmTask extends ConventionTask {
|
||||
String projectName = project.group.toString() + ":" + project.name.toString() + ":" + this.project.version.toString()
|
||||
project.logger.info("Pushing Stubs to SCM for project [" + projectName + "]")
|
||||
StubRunnerOptions options = getDownloader().options(getConfigProperties())
|
||||
new ContractProjectUpdater(options).updateContractProject(projectName, getStubsOutputDir().toPath());
|
||||
new ContractProjectUpdater(options).updateContractProject(projectName, getStubsOutputDir().toPath())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ abstract class ContractVerifierIntegrationSpec extends Specification {
|
||||
}
|
||||
|
||||
private static class CopyFileVisitor extends SimpleFileVisitor<Path> {
|
||||
private final Path targetPath;
|
||||
private final Path targetPath
|
||||
private Path sourcePath = null
|
||||
CopyFileVisitor(Path targetPath) {
|
||||
this.targetPath = targetPath
|
||||
|
||||
@@ -20,16 +20,18 @@ import java.io.File;
|
||||
|
||||
import io.takari.maven.testing.TestMavenRuntime;
|
||||
import io.takari.maven.testing.TestResources;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.boot.test.rule.OutputCapture;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import static io.takari.maven.testing.TestMavenRuntime.newParameter;
|
||||
import static io.takari.maven.testing.TestResources.assertFilesNotPresent;
|
||||
import static io.takari.maven.testing.TestResources.assertFilesPresent;
|
||||
import static java.nio.charset.Charset.defaultCharset;
|
||||
import static org.apache.commons.io.FileUtils.readFileToString;
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
|
||||
public class PluginUnitTest {
|
||||
@@ -99,7 +101,7 @@ public class PluginUnitTest {
|
||||
String path = "target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/ContractVerifierSpec.groovy";
|
||||
assertFilesPresent(basedir, path);
|
||||
File test = new File(basedir, path);
|
||||
then(FileUtils.readFileToString(test)).contains("spock.lang.Ignore");
|
||||
then(readFileToString(test, defaultCharset())).contains("spock.lang.Ignore");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -127,7 +129,7 @@ public class PluginUnitTest {
|
||||
"target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/ContractVerifierTest.java");
|
||||
File test = new File(basedir,
|
||||
"target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/ContractVerifierTest.java");
|
||||
then(FileUtils.readFileToString(test)).doesNotContain("hasSize(4)");
|
||||
then(readFileToString(test, defaultCharset())).doesNotContain("hasSize(4)");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -139,7 +141,8 @@ public class PluginUnitTest {
|
||||
"target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/ContractVerifierTest.java");
|
||||
File test = new File(basedir,
|
||||
"target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/ContractVerifierTest.java");
|
||||
then(FileUtils.readFileToString(test)).contains("hasSize(4)");
|
||||
then(readFileToString(test, defaultCharset()
|
||||
)).contains("hasSize(4)");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -252,7 +255,7 @@ public class PluginUnitTest {
|
||||
String path = "target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/hello/V1Test.java";
|
||||
assertFilesPresent(basedir, path);
|
||||
File test = new File(basedir, path);
|
||||
then(FileUtils.readFileToString(test)).contains("extends HelloV1Base")
|
||||
then(readFileToString(test, defaultCharset())).contains("extends HelloV1Base")
|
||||
.contains("import hello.HelloV1Base");
|
||||
}
|
||||
|
||||
@@ -267,7 +270,7 @@ public class PluginUnitTest {
|
||||
String path = "target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/hello/V1Spec.groovy";
|
||||
assertFilesPresent(basedir, path);
|
||||
File test = new File(basedir, path);
|
||||
then(FileUtils.readFileToString(test)).contains("extends HelloV1Base")
|
||||
then(readFileToString(test, defaultCharset())).contains("extends HelloV1Base")
|
||||
.contains("import hello.HelloV1Base");
|
||||
}
|
||||
|
||||
@@ -282,7 +285,7 @@ public class PluginUnitTest {
|
||||
String path = "target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/com/hello/V1Test.java";
|
||||
assertFilesPresent(basedir, path);
|
||||
File test = new File(basedir, path);
|
||||
then(FileUtils.readFileToString(test)).contains("extends TestBase")
|
||||
then(readFileToString(test, defaultCharset())).contains("extends TestBase")
|
||||
.contains("import com.example.TestBase");
|
||||
}
|
||||
|
||||
@@ -297,7 +300,7 @@ public class PluginUnitTest {
|
||||
String path = "target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/com/hello/V1Spec.groovy";
|
||||
assertFilesPresent(basedir, path);
|
||||
File test = new File(basedir, path);
|
||||
then(FileUtils.readFileToString(test)).contains("extends TestBase")
|
||||
then(readFileToString(test, defaultCharset())).contains("extends TestBase")
|
||||
.contains("import com.example.TestBase");
|
||||
}
|
||||
|
||||
@@ -312,7 +315,7 @@ public class PluginUnitTest {
|
||||
String path = "target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/com/hello/V1Test.java";
|
||||
assertFilesPresent(basedir, path);
|
||||
File test = new File(basedir, path);
|
||||
then(FileUtils.readFileToString(test))
|
||||
then(readFileToString(test, defaultCharset()))
|
||||
.contains("public void validate_should_post_a_user() throws Exception {")
|
||||
.contains("public void validate_withList_1() throws Exception {");
|
||||
}
|
||||
@@ -329,12 +332,12 @@ public class PluginUnitTest {
|
||||
File test = new File(basedir, firstFile);
|
||||
assertFilesPresent(basedir,
|
||||
"target/foo/META-INF/org.springframework.cloud.verifier.sample/sample-project/0.1/mappings/com/hello/v1/1_WithList.json");
|
||||
then(FileUtils.readFileToString(test)).contains("/users/1");
|
||||
then(readFileToString(test, defaultCharset())).contains("/users/1");
|
||||
String secondFile = "target/foo/META-INF/org.springframework.cloud.verifier.sample/sample-project/0.1/mappings/com/hello/v1/1_WithList.json";
|
||||
File test2 = new File(basedir, secondFile);
|
||||
assertFilesPresent(basedir,
|
||||
"target/foo/META-INF/org.springframework.cloud.verifier.sample/sample-project/0.1/mappings/com/hello/v1/should post a user.json");
|
||||
then(FileUtils.readFileToString(test2)).contains("/users/2");
|
||||
then(readFileToString(test2, defaultCharset())).contains("/users/2");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -363,7 +366,7 @@ public class PluginUnitTest {
|
||||
"target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/ContractVerifierTest.java");
|
||||
File test = new File(basedir,
|
||||
"target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/ContractVerifierTest.java");
|
||||
String testContents = FileUtils.readFileToString(test);
|
||||
String testContents = readFileToString(test, defaultCharset());
|
||||
int countOccurrencesOf = StringUtils.countOccurrencesOf(testContents,
|
||||
"\t\tMockMvcRequestSpecification");
|
||||
then(countOccurrencesOf).isEqualTo(4);
|
||||
|
||||
@@ -19,7 +19,7 @@ package hello
|
||||
import io.restassured.module.mockmvc.RestAssuredMockMvc
|
||||
import spock.lang.Specification
|
||||
|
||||
public class BaseAccurest extends Specification {
|
||||
class BaseAccurest extends Specification {
|
||||
|
||||
def setup() {
|
||||
RestAssuredMockMvc.standaloneSetup(new GreetingController())
|
||||
|
||||
@@ -82,11 +82,11 @@ class MatchingRulesConverter {
|
||||
break
|
||||
case MatchingType.REGEX:
|
||||
String pattern = it.value().toString()
|
||||
if (pattern.equals(regexPatterns.number().pattern())) {
|
||||
if (pattern == regexPatterns.number().pattern()) {
|
||||
category.addRule(key, new NumberTypeMatcher(NumberTypeMatcher.NumberType.NUMBER))
|
||||
} else if (pattern.equals(regexPatterns.anInteger().pattern())) {
|
||||
} else if (pattern == regexPatterns.anInteger().pattern()) {
|
||||
category.addRule(key, new NumberTypeMatcher(NumberTypeMatcher.NumberType.INTEGER))
|
||||
} else if (pattern.equals(regexPatterns.aDouble().pattern())) {
|
||||
} else if (pattern == regexPatterns.aDouble().pattern()) {
|
||||
category.addRule(key, new NumberTypeMatcher(NumberTypeMatcher.NumberType.DECIMAL))
|
||||
} else {
|
||||
category.addRule(key, new RegexMatcher(pattern))
|
||||
|
||||
@@ -69,7 +69,7 @@ class MessagingSCContractCreator {
|
||||
throw new UnsupportedOperationException("Currently only the AND combination rule logic is supported")
|
||||
}
|
||||
|
||||
if (FULL_BODY.equals(key)) {
|
||||
if (FULL_BODY == key) {
|
||||
JsonPaths jsonPaths = JsonToJsonPathsConverter.transformToJsonPathWithStubsSideValuesAndNoArraySizeCheck(message.contents.value)
|
||||
jsonPaths.each {
|
||||
jsonPath(it.keyBeforeChecking(), byType())
|
||||
|
||||
@@ -49,7 +49,7 @@ class RequestResponsePactCreator {
|
||||
Names names = NamingUtil.name(contracts.get(0))
|
||||
PactDslWithProvider pactDslWithProvider = ConsumerPactBuilder
|
||||
.consumer(names.consumer).hasPactWith(names.producer)
|
||||
PactDslResponse pactDslResponse = null;
|
||||
PactDslResponse pactDslResponse = null
|
||||
contracts.each { Contract contract ->
|
||||
assertNoExecutionProperty(contract)
|
||||
PactDslRequestWithPath pactDslRequest = pactDslResponse ?
|
||||
|
||||
@@ -168,7 +168,7 @@ class RequestResponseSCContractCreator {
|
||||
throw new UnsupportedOperationException("Currently only the AND combination rule logic is supported")
|
||||
}
|
||||
|
||||
if (FULL_BODY.equals(key)) {
|
||||
if (FULL_BODY == key) {
|
||||
JsonPaths jsonPaths = JsonToJsonPathsConverter.transformToJsonPathWithStubsSideValuesAndNoArraySizeCheck(response.body.value)
|
||||
jsonPaths.each {
|
||||
jsonPath(it.keyBeforeChecking(), byType())
|
||||
|
||||
@@ -170,7 +170,7 @@ class JaxRsClientJUnitMethodBodyBuilder extends JUnitMethodBodyBuilder {
|
||||
}
|
||||
|
||||
protected String getHeader(String name) {
|
||||
return request.headers?.entries.find { it.name == name }?.serverValue
|
||||
return request.headers?.entries?.find { it.name == name }?.serverValue
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -77,7 +77,7 @@ abstract class RequestProcessingMethodBodyBuilder extends MethodBodyBuilder {
|
||||
* Returns {@code true} if a response body is expected
|
||||
*/
|
||||
protected boolean expectsResponseBody() {
|
||||
return response.body != null;
|
||||
return response.body != null
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -45,9 +45,9 @@ import org.springframework.core.io.support.SpringFactoriesLoader
|
||||
@Commons
|
||||
class ContractFileScanner {
|
||||
|
||||
private static final String OS_NAME = System.getProperty("os.name");
|
||||
private static final String OS_NAME_WINDOWS_PREFIX = "Windows";
|
||||
protected static final boolean IS_OS_WINDOWS = getOSMatchesName(OS_NAME_WINDOWS_PREFIX);
|
||||
private static final String OS_NAME = System.getProperty("os.name")
|
||||
private static final String OS_NAME_WINDOWS_PREFIX = "Windows"
|
||||
protected static final boolean IS_OS_WINDOWS = getOSMatchesName(OS_NAME_WINDOWS_PREFIX)
|
||||
|
||||
private static final String MATCH_PREFIX = "glob:"
|
||||
private static final Pattern SCENARIO_STEP_FILENAME_PATTERN = Pattern.compile("[0-9]+_.*")
|
||||
@@ -210,15 +210,15 @@ class ContractFileScanner {
|
||||
if (path == null) {
|
||||
return null
|
||||
}
|
||||
int extIndex = path.lastIndexOf('.');
|
||||
int extIndex = path.lastIndexOf('.')
|
||||
if (extIndex == -1) {
|
||||
return null
|
||||
}
|
||||
int folderIndex = path.lastIndexOf('/');
|
||||
int folderIndex = path.lastIndexOf('/')
|
||||
if (folderIndex > extIndex) {
|
||||
return null
|
||||
}
|
||||
return path.substring(extIndex + 1);
|
||||
return path.substring(extIndex + 1)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -228,7 +228,7 @@ class ContractFileScanner {
|
||||
* @return true if matches, or false if not or can't determine
|
||||
*/
|
||||
private static boolean getOSMatchesName(final String osNamePrefix) {
|
||||
return isOSNameMatch(OS_NAME, osNamePrefix);
|
||||
return isOSNameMatch(OS_NAME, osNamePrefix)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -243,8 +243,8 @@ class ContractFileScanner {
|
||||
*/
|
||||
private static boolean isOSNameMatch(final String osName, final String osNamePrefix) {
|
||||
if (osName == null) {
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
return osName.startsWith(osNamePrefix);
|
||||
return osName.startsWith(osNamePrefix)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ class BodyExtractor {
|
||||
* client side.
|
||||
*/
|
||||
static String extractStubValueFrom(Object body) {
|
||||
Object bodyValue = extractClientValueFromBody(body);
|
||||
Object bodyValue = extractClientValueFromBody(body)
|
||||
String json = new JsonOutput().toJson(bodyValue)
|
||||
json = StringEscapeUtils.unescapeJavaScript(json)
|
||||
return trimRepeatedQuotes(json)
|
||||
|
||||
@@ -41,7 +41,7 @@ import java.util.function.Predicate
|
||||
@CompileStatic
|
||||
final class ContractScanner {
|
||||
|
||||
private static final Log log = LogFactory.getLog(ContractScanner.class);
|
||||
private static final Log log = LogFactory.getLog(ContractScanner.class)
|
||||
|
||||
/**
|
||||
* Traverses through the directories, applies converters
|
||||
|
||||
@@ -21,7 +21,8 @@ import org.springframework.cloud.contract.verifier.config.TestFramework
|
||||
import org.springframework.cloud.contract.verifier.config.TestMode
|
||||
|
||||
class MainTest {
|
||||
public static void main(String[] args) {
|
||||
|
||||
static void main(String[] args) {
|
||||
ContractVerifierConfigProperties properties = new ContractVerifierConfigProperties(
|
||||
contractsDslDir: new File('/some/path/dsl'),
|
||||
generatedTestSourcesDir: new File('/tmp/contracts'),
|
||||
|
||||
@@ -515,7 +515,7 @@ class SingleTestGeneratorSpec extends Specification {
|
||||
}
|
||||
''')
|
||||
and:
|
||||
ContractVerifierConfigProperties properties = new ContractVerifierConfigProperties();
|
||||
ContractVerifierConfigProperties properties = new ContractVerifierConfigProperties()
|
||||
properties.testFramework =testFramework
|
||||
ContractMetadata contract = new ContractMetadata(secondFile.toPath(), false, 1, null, convertAsCollection(new File('/'), secondFile))
|
||||
JavaTestGenerator testGenerator = new JavaTestGenerator()
|
||||
@@ -547,7 +547,7 @@ class SingleTestGeneratorSpec extends Specification {
|
||||
}
|
||||
}''')
|
||||
and:
|
||||
ContractVerifierConfigProperties properties = new ContractVerifierConfigProperties();
|
||||
ContractVerifierConfigProperties properties = new ContractVerifierConfigProperties()
|
||||
properties.testFramework =testFramework
|
||||
ContractMetadata contract = new ContractMetadata(secondFile.toPath(), false, 1, null, convertAsCollection(new File('/'), secondFile))
|
||||
JavaTestGenerator testGenerator = new JavaTestGenerator()
|
||||
@@ -579,7 +579,7 @@ class SingleTestGeneratorSpec extends Specification {
|
||||
}
|
||||
}''')
|
||||
and:
|
||||
ContractVerifierConfigProperties properties = new ContractVerifierConfigProperties();
|
||||
ContractVerifierConfigProperties properties = new ContractVerifierConfigProperties()
|
||||
properties.testFramework =testFramework
|
||||
ContractMetadata contract = new ContractMetadata(secondFile.toPath(), false, 1, null, convertAsCollection(new File('/'), secondFile))
|
||||
JavaTestGenerator testGenerator = new JavaTestGenerator()
|
||||
|
||||
@@ -26,7 +26,7 @@ class WireMockResponseStubStrategySpec extends Specification {
|
||||
def subject = new WireMockResponseStubStrategy(contract)
|
||||
def content = subject.buildClientResponseContent()
|
||||
then:
|
||||
'{"value":1.5}'.equals(content.body)
|
||||
'{"value":1.5}' == content.body
|
||||
}
|
||||
|
||||
@Issue("#468")
|
||||
|
||||
@@ -914,7 +914,7 @@ class JsonToJsonPathsConverterSpec extends Specification {
|
||||
}
|
||||
|
||||
private void assertThatJsonPathsInMapAreValid(String json, JsonPaths pathAndValues) {
|
||||
DocumentContext parsedJson = JsonPath.using(Configuration.builder().options(Option.ALWAYS_RETURN_LIST).build()).parse(json);
|
||||
DocumentContext parsedJson = JsonPath.using(Configuration.builder().options(Option.ALWAYS_RETURN_LIST).build()).parse(json)
|
||||
pathAndValues.each {
|
||||
assert !parsedJson.read(it.jsonPath(), JSONArray).empty
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.springframework.boot.test.context.SpringBootContextLoader
|
||||
import org.springframework.cloud.contract.spec.Contract
|
||||
import org.springframework.cloud.contract.verifier.messaging.MessageVerifier
|
||||
import org.springframework.cloud.contract.verifier.messaging.boot.AutoConfigureMessageVerifier
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierObjectMapper;
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierObjectMapper
|
||||
import org.springframework.test.context.ContextConfiguration
|
||||
|
||||
import spock.lang.Specification
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.springframework.boot.test.context.SpringBootContextLoader
|
||||
import org.springframework.cloud.contract.spec.Contract
|
||||
import org.springframework.cloud.contract.verifier.messaging.MessageVerifier
|
||||
import org.springframework.cloud.contract.verifier.messaging.boot.AutoConfigureMessageVerifier
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierObjectMapper;
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierObjectMapper
|
||||
import org.springframework.messaging.Message
|
||||
import org.springframework.test.context.ContextConfiguration
|
||||
|
||||
|
||||
Reference in New Issue
Block a user