From cafe8db3a4ea48c8df741547de55ae7a101987a8 Mon Sep 17 00:00:00 2001 From: Gary O'Neall Date: Sat, 19 Apr 2025 11:42:20 -0700 Subject: [PATCH] Normalize whitespace in schema compare unit test Fixes an issue where the compare fails if run on a windows environment where CRLF is used instead of LF --- src/test/java/org/spdx/tools/LatestSchemaVersionTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/spdx/tools/LatestSchemaVersionTest.java b/src/test/java/org/spdx/tools/LatestSchemaVersionTest.java index b18a8f2..90e517e 100644 --- a/src/test/java/org/spdx/tools/LatestSchemaVersionTest.java +++ b/src/test/java/org/spdx/tools/LatestSchemaVersionTest.java @@ -37,9 +37,9 @@ public void testLatestSpdxSchemaVersionIsUpToDate() throws IOException { String version = extractVersionNumber(fileName); // Step 2: Compare the content of the file with the content from the URL - String localSchemaContent = Files.readString(schemaFilePath); + String localSchemaContent = Files.readString(schemaFilePath).replaceAll("\\s+", " "); String remoteSchemaUrl = "https://spdx.org/schema/" + version + "/spdx-json-schema.json"; - String remoteSchemaContent = IOUtils.toString(URI.create(remoteSchemaUrl).toURL(), "UTF-8"); + String remoteSchemaContent = IOUtils.toString(URI.create(remoteSchemaUrl).toURL(), "UTF-8").replaceAll("\\s+", " "); assertEquals("The local SPDX schema file does not match the remote schema content.", localSchemaContent.trim(), remoteSchemaContent.trim()); }