diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/DiffPrinter.java b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/DiffPrinter.java index 05639c27f949..5ec2a200672e 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/DiffPrinter.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/DiffPrinter.java @@ -23,7 +23,11 @@ class DiffPrinter { //print the difference of two print to out static void printDiff(PrintWriter out, String expected, String actual) { - DiffRowGenerator generator = DiffRowGenerator.create().showInlineDiffs(true).inlineDiffByWord(true).oldTag( + boolean inlineDiffByWordFlag = false; + if(expected.contains(" ") || actual.contains(" ")){ + inlineDiffByWordFlag = true; + } + DiffRowGenerator generator = DiffRowGenerator.create().showInlineDiffs(true).inlineDiffByWord(inlineDiffByWordFlag).oldTag( f -> "~~").newTag(f -> "**").build(); List rows = generator.generateDiffRows(Arrays.asList(expected), Arrays.asList(actual)); out.println();