Skip to content

Commit da2c3b9

Browse files
committed
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
1 parent c391d5c commit da2c3b9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/test/java/org/spdx/tools/LatestSchemaVersionTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ public void testLatestSpdxSchemaVersionIsUpToDate() throws IOException {
3737
String version = extractVersionNumber(fileName);
3838

3939
// Step 2: Compare the content of the file with the content from the URL
40-
String localSchemaContent = Files.readString(schemaFilePath);
40+
String localSchemaContent = Files.readString(schemaFilePath).replaceAll("\\s+", " ");
4141
String remoteSchemaUrl = "https://spdx.org/schema/" + version + "/spdx-json-schema.json";
42-
String remoteSchemaContent = IOUtils.toString(URI.create(remoteSchemaUrl).toURL(), "UTF-8");
42+
String remoteSchemaContent = IOUtils.toString(URI.create(remoteSchemaUrl).toURL(), "UTF-8").replaceAll("\\s+", " ");
4343
assertEquals("The local SPDX schema file does not match the remote schema content.",
4444
localSchemaContent.trim(), remoteSchemaContent.trim());
4545
}

0 commit comments

Comments
 (0)