Skip to content

Commit

Permalink
Fix failing test on Windows due to line separators.
Browse files Browse the repository at this point in the history
  • Loading branch information
bdferris-v2 committed Apr 7, 2023
1 parent 807d8a8 commit 994b2fa
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ private static String retrieveReportString(Path path) throws IOException {
String content = Files.readString(path);
Gson gson = new GsonBuilder().setPrettyPrinting().create();
JsonObject obj = gson.fromJson(content, JsonObject.class);
return gson.toJson(obj);
String jsonAsString = gson.toJson(obj);
// On Windows systems, the pretty-printed JSON output will have window line separators, which
// will cause a test failure when comparing against our expected strings with Unix line
// separators if we don't normalize them.
return jsonAsString.replace(System.lineSeparator(), "\n");
}

private static String retrieveResource(String name) throws IOException {
Expand Down

0 comments on commit 994b2fa

Please sign in to comment.