diff --git a/src/systemtest/java/reposense/util/SystemTestUtil.java b/src/systemtest/java/reposense/util/SystemTestUtil.java index 6d1ac7a506..722d767758 100644 --- a/src/systemtest/java/reposense/util/SystemTestUtil.java +++ b/src/systemtest/java/reposense/util/SystemTestUtil.java @@ -9,6 +9,7 @@ import org.junit.jupiter.api.Assertions; +import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; @@ -63,10 +64,16 @@ public static void assertSummaryJson(Path expectedSummaryJsonPath, Path actualSu */ public static void assertJson(Path expectedJsonPath, Path actualJsonPath) { Assertions.assertTrue(Files.exists(actualJsonPath)); - try { - Assertions.assertTrue(TestUtil.compareFileContents(expectedJsonPath, actualJsonPath)); - } catch (Exception e) { - Assertions.fail(e.getMessage()); + + try (FileReader fileReaderExpected = new FileReader(expectedJsonPath.toFile()); + FileReader fileReaderActual = new FileReader(actualJsonPath.toFile())) { + + JsonElement jsonExpected = JsonParser.parseReader(fileReaderExpected); + JsonElement jsonActual = JsonParser.parseReader(fileReaderActual); + + Assertions.assertEquals(jsonExpected, jsonActual); + } catch (IOException ex) { + Assertions.fail(ex.getMessage()); } } }