Skip to content

Commit

Permalink
Another attempt at debugging a test failure.
Browse files Browse the repository at this point in the history
  • Loading branch information
eamonnmcmanus committed Jul 26, 2023
1 parent 9c71200 commit f72f871
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,16 +227,16 @@ private static void assertFormatted(String formattedPattern, TypeAdapterFactory
try {
assertThat(json).matches(toLiteral(formattedPattern));
} catch (AssertionError e) {
StringBuilder sb = new StringBuilder();
char[] chars = json.toCharArray();
for (char c : chars) {
if (c >= ' ' && c <= '~') {
System.err.print(c);
sb.append(c);
} else {
System.err.printf("\\u%04x", (int) c);
sb.append(String.format("\\u%04x", (int) c));
}
}
System.err.println();
throw e;
throw new AssertionError(sb.toString(), e);
}
}

Expand Down

0 comments on commit f72f871

Please sign in to comment.