From 4934f8a0d82e5cee9fa08de47808aee900167279 Mon Sep 17 00:00:00 2001 From: Yang Chen <583334298@qq.com> Date: Tue, 13 Jul 2021 12:28:48 +0800 Subject: [PATCH] Fix a flaky test. --- pom.xml | 6 ++++++ .../java/com/lazerycode/jmeter/json/TestConfigTest.java | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e9a78d17..396458d0 100644 --- a/pom.xml +++ b/pom.xml @@ -189,6 +189,12 @@ + + net.javacrumbs.json-unit + json-unit-assertj + 2.4.0 + test + org.apache.maven maven-plugin-api diff --git a/src/test/java/com/lazerycode/jmeter/json/TestConfigTest.java b/src/test/java/com/lazerycode/jmeter/json/TestConfigTest.java index 5d2dbfa3..abdaa051 100644 --- a/src/test/java/com/lazerycode/jmeter/json/TestConfigTest.java +++ b/src/test/java/com/lazerycode/jmeter/json/TestConfigTest.java @@ -13,6 +13,7 @@ import java.util.UUID; import static org.assertj.core.api.Assertions.assertThat; +import static net.javacrumbs.jsonunit.assertj.JsonAssertions.assertThatJson; public class TestConfigTest { @@ -24,7 +25,7 @@ public void createConfigFromResourceFile() throws MojoExecutionException, URISyn URL configFile = this.getClass().getResource(testConfigFile); File testConfigJSON = new File(configFile.toURI()); TestConfigurationWrapper testConfig = new TestConfigurationWrapper(testConfigJSON, "test-execution"); - assertThat(testConfig.getFullConfig()) + assertThatJson(testConfig.getFullConfig()) .isEqualTo("{\"executionID\":\"test-execution\",\"jmeterDirectoryPath\":null,\"runtimeJarName\":null,\"resultsOutputIsCSVFormat\":false,\"generateReports\":false,\"resultFilesLocations\":[],\"propertiesMap\":null,\"jmeterWorkingDirectoryPath\":null}"); }