Skip to content

Commit e441502

Browse files
kiviewmeistermeier
authored andcommitted
GH-2447 - Fix ResultSummariesTest on Windows.
The test was asserting for `\n` in the rendered summary, while the formatting code uses System.lineSeparator(). This changes the test to check for the platform dependent line separator. Closes #2447
1 parent 318e1bc commit e441502

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

src/test/java/org/springframework/data/neo4j/core/ResultSummariesTest.java

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,29 +29,32 @@
2929

3030
/**
3131
* @author Michael J. Simons
32+
* @author Kevin Wittek
3233
* @soundtrack Fatoni & Dexter - Yo, Picasso
3334
*/
3435
class ResultSummariesTest {
3536

37+
private static final String LINE_SEPARATOR = System.lineSeparator();
38+
3639
private static Stream<Arguments> params() {
3740
return Stream.of(
3841
Arguments.of("match (n) - [r:FOO*] -> (m) RETURN r", 1, 19, ""
39-
+ "\tmatch (n) - [r:FOO*] -> (m) RETURN r\n"
40-
+ "\t ^\n"),
42+
+ "\tmatch (n) - [r:FOO*] -> (m) RETURN r" + LINE_SEPARATOR
43+
+ "\t ^" + LINE_SEPARATOR),
4144
Arguments.of("match (n)\n- [r:FOO*] -> (m) RETURN r", 2, 1, ""
42-
+ "\tmatch (n)\n"
43-
+ "\t- [r:FOO*] -> (m) RETURN r\n"
44-
+ "\t^\n"),
45+
+ "\tmatch (n)" + LINE_SEPARATOR
46+
+ "\t- [r:FOO*] -> (m) RETURN r" + LINE_SEPARATOR
47+
+ "\t^" + LINE_SEPARATOR),
4548
Arguments.of("match (x0123456789) \nwith x0123456789\nmatch(n) - [r:FOO*] -> (m) RETURN r", 3, 10, ""
46-
+ "\tmatch (x0123456789) \n"
47-
+ "\twith x0123456789\n"
48-
+ "\tmatch(n) - [r:FOO*] -> (m) RETURN r\n"
49-
+ "\t ^\n"),
49+
+ "\tmatch (x0123456789) " + LINE_SEPARATOR
50+
+ "\twith x0123456789" + LINE_SEPARATOR
51+
+ "\tmatch(n) - [r:FOO*] -> (m) RETURN r" + LINE_SEPARATOR
52+
+ "\t ^" + LINE_SEPARATOR),
5053
Arguments.of("match (n) \n- [r:FOO*] -> (m) \nRETURN r", 2, 1, ""
51-
+ "\tmatch (n) \n"
52-
+ "\t- [r:FOO*] -> (m) \n"
53-
+ "\t^\n"
54-
+ "\tRETURN r\n")
54+
+ "\tmatch (n) " + LINE_SEPARATOR
55+
+ "\t- [r:FOO*] -> (m) " + LINE_SEPARATOR
56+
+ "\t^" + LINE_SEPARATOR
57+
+ "\tRETURN r" + LINE_SEPARATOR)
5558
);
5659
}
5760

@@ -71,7 +74,7 @@ void shouldFormatNotifications(String query, int line, int column, String expect
7174
when(notification.position()).thenReturn(inputPosition);
7275

7376
String formattedNotification = ResultSummaries.format(notification, query);
74-
assertThat(formattedNotification).isEqualTo("KGQ.Warning: Das ist keine gute Query.\n"
77+
assertThat(formattedNotification).isEqualTo("KGQ.Warning: Das ist keine gute Query." + LINE_SEPARATOR
7578
+ expected
7679
+ "Das solltest Du besser nicht mehr machen.");
7780
}

0 commit comments

Comments
 (0)