Skip to content
This repository was archived by the owner on Jul 6, 2023. It is now read-only.

Commit 73c843e

Browse files
committed
Adapt tests to windows line endings.
1 parent b052602 commit 73c843e

File tree

3 files changed

+48
-37
lines changed

3 files changed

+48
-37
lines changed

cypher-shell/src/integration-test/java/org/neo4j/shell/commands/CypherShellVerboseIntegrationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public void paramsAndListVariablesWithSpecialCharacters() throws CommandExceptio
195195
public void cypherWithOrder() throws CommandException {
196196
// given
197197
String serverVersion = shell.getServerVersion();
198-
assumeTrue(minorVersion(serverVersion) >= 5 || majorVersion(serverVersion) == 4);
198+
assumeTrue(minorVersion(serverVersion) == 6 || majorVersion(serverVersion) == 4);
199199

200200
shell.execute( "CREATE INDEX ON :Person(age)" );
201201

cypher-shell/src/test/java/org/neo4j/shell/prettyprint/PrettyPrinterTest.java

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import static org.mockito.Mockito.mock;
3333
import static org.mockito.Mockito.when;
3434
import static org.neo4j.driver.internal.util.Iterables.map;
35+
import static org.neo4j.shell.prettyprint.OutputFormatter.NEWLINE;
3536

3637
@SuppressWarnings("ArraysAsListWithZeroOrOneArgument")
3738
public class PrettyPrinterTest {
@@ -144,13 +145,17 @@ public void prettyPrintList() {
144145
String actual = plainPrinter.format(result);
145146

146147
// then
147-
assertThat(actual, is("col1, col2\n[\"val1_1\", \"val1_2\"], [\"val2_1\"]\n[\"val2_1\"]\n"));
148+
assertThat(actual, is(String.join(NEWLINE,
149+
"col1, col2",
150+
"[\"val1_1\", \"val1_2\"], [\"val2_1\"]",
151+
"[\"val2_1\"]",
152+
"")));
148153
}
149154

150155
@Test
151156
public void prettyPrintMaps() {
152-
checkMapForPrettyPrint(map(), "map\n{}\n");
153-
checkMapForPrettyPrint(map("abc", "def"), "map\n{abc: def}\n");
157+
checkMapForPrettyPrint(map(), "map"+NEWLINE+"{}"+NEWLINE);
158+
checkMapForPrettyPrint(map("abc", "def"), "map"+NEWLINE+"{abc: def}"+NEWLINE);
154159
}
155160

156161
private void checkMapForPrettyPrint(Map<String, String> map, String expectedResult) {
@@ -200,8 +205,8 @@ public void prettyPrintNode() {
200205
String actual = plainPrinter.format(result);
201206

202207
// then
203-
assertThat(actual, is("col1, col2\n" +
204-
"(:label1:label2 {prop2: prop2_value, prop1: prop1_value})\n"));
208+
assertThat(actual, is("col1, col2" + NEWLINE +
209+
"(:label1:label2 {prop2: prop2_value, prop1: prop1_value})" + NEWLINE));
205210
}
206211

207212
@Test
@@ -230,7 +235,8 @@ public void prettyPrintRelationships() {
230235
String actual = plainPrinter.format(result);
231236

232237
// then
233-
assertThat(actual, is("rel\n[:RELATIONSHIP_TYPE {prop2: prop2_value, prop1: prop1_value}]\n"));
238+
assertThat(actual, is("rel" + NEWLINE+
239+
"[:RELATIONSHIP_TYPE {prop2: prop2_value, prop1: prop1_value}]" + NEWLINE));
234240
}
235241

236242
@Test
@@ -272,8 +278,10 @@ public void printRelationshipsAndNodesWithEscapingForSpecialCharacters() {
272278
String actual = plainPrinter.format(result);
273279

274280
// then
275-
assertThat(actual, is("rel, node\n[:`RELATIONSHIP,TYPE` {prop2: prop2_value, prop1: \"prop1, value\"}], " +
276-
"(:`label ``1`:label2 {prop1: \"prop1:value\", `1prop2`: \"\", ä: not-escaped})\n"));
281+
assertThat(actual, is(
282+
"rel, node" + NEWLINE +
283+
"[:`RELATIONSHIP,TYPE` {prop2: prop2_value, prop1: \"prop1, value\"}], " +
284+
"(:`label ``1`:label2 {prop1: \"prop1:value\", `1prop2`: \"\", ä: not-escaped})" + NEWLINE));
277285
}
278286

279287
@Test
@@ -331,9 +339,9 @@ public void prettyPrintPaths() {
331339
String actual = plainPrinter.format(result);
332340

333341
// then
334-
assertThat(actual, is("path\n" +
342+
assertThat(actual, is("path" + NEWLINE +
335343
"(:start {prop1: prop1_value})-[:RELATIONSHIP_TYPE]->" +
336-
"(:middle)<-[:RELATIONSHIP_TYPE]-(:end {prop2: prop2_value})\n"));
344+
"(:middle)<-[:RELATIONSHIP_TYPE]-(:end {prop2: prop2_value})" + NEWLINE));
337345
}
338346

339347
@Test
@@ -375,7 +383,7 @@ public void prettyPrintSingleNodePath() {
375383
String actual = plainPrinter.format(result);
376384

377385
// then
378-
assertThat(actual, is("path\n(:start)-[:RELATIONSHIP_TYPE]->(:end)\n"));
386+
assertThat(actual, is("path" + NEWLINE + "(:start)-[:RELATIONSHIP_TYPE]->(:end)" + NEWLINE));
379387
}
380388

381389
@Test
@@ -435,8 +443,8 @@ public void prettyPrintThreeSegmentPath() {
435443
String actual = plainPrinter.format(result);
436444

437445
// then
438-
assertThat(actual, is("path\n" +
446+
assertThat(actual, is("path" + NEWLINE +
439447
"(:start)-[:RELATIONSHIP_TYPE]->" +
440-
"(:second)<-[:RELATIONSHIP_TYPE]-(:third)-[:RELATIONSHIP_TYPE]->(:end)\n"));
448+
"(:second)<-[:RELATIONSHIP_TYPE]-(:third)-[:RELATIONSHIP_TYPE]->(:end)" + NEWLINE));
441449
}
442450
}

cypher-shell/src/test/java/org/neo4j/shell/prettyprint/TableOutputFormatterTest.java

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import static org.mockito.Matchers.anyObject;
4040
import static org.mockito.Mockito.mock;
4141
import static org.mockito.Mockito.when;
42+
import static org.neo4j.shell.prettyprint.OutputFormatter.NEWLINE;
4243

4344
@SuppressWarnings("ArraysAsListWithZeroOrOneArgument")
4445
public class TableOutputFormatterTest {
@@ -290,19 +291,20 @@ public void wrapContent()
290291
new TableOutputFormatter(true, 2).format(new ListBoltResult(result.list(), result.summary()), printer);
291292
String table = printer.result();
292293
// THEN
293-
assertThat(table, is(
294-
"+------+\n" +
295-
"| c1 |\n" +
296-
"+------+\n" +
297-
"| \"a\" |\n" +
298-
"| \"bb\" |\n" +
299-
"| \"ccc |\n" +
300-
"| \" |\n" +
301-
"| \"ddd |\n" +
302-
"| d\" |\n" +
303-
"| \"eee |\n" +
304-
"| ee\" |\n" +
305-
"+------+\n"));
294+
assertThat(table, is(String.join(NEWLINE,
295+
"+------+",
296+
"| c1 |",
297+
"+------+",
298+
"| \"a\" |",
299+
"| \"bb\" |",
300+
"| \"ccc |",
301+
"| \" |",
302+
"| \"ddd |",
303+
"| d\" |",
304+
"| \"eee |",
305+
"| ee\" |",
306+
"+------+",
307+
"")));
306308
}
307309

308310
@Test
@@ -315,16 +317,17 @@ public void truncateContent()
315317
new TableOutputFormatter(false, 2).format(new ListBoltResult(result.list(), result.summary()), printer);
316318
String table = printer.result();
317319
// THEN
318-
assertThat(table, is(
319-
"+------+\n" +
320-
"| c1 |\n" +
321-
"+------+\n" +
322-
"| \"a\" |\n" +
323-
"| \"bb\" |\n" +
324-
"| \"cc… |\n" +
325-
"| \"dd… |\n" +
326-
"| \"ee… |\n" +
327-
"+------+\n"));
320+
assertThat(table, is(String.join(NEWLINE,
321+
"+------+",
322+
"| c1 |",
323+
"+------+",
324+
"| \"a\" |",
325+
"| \"bb\" |",
326+
"| \"cc… |",
327+
"| \"dd… |",
328+
"| \"ee… |",
329+
"+------+",
330+
"")));
328331
}
329332

330333
@Test

0 commit comments

Comments
 (0)