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

Commit 10a7221

Browse files
committed
fix integration test by moving it to to plain format
1 parent d61e2c5 commit 10a7221

File tree

2 files changed

+40
-40
lines changed

2 files changed

+40
-40
lines changed

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

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,44 @@ public void periodicCommitWorks() throws CommandException {
5555
List<String> queryResult = captor.getAllValues();
5656
assertThat(queryResult.get(1), containsString("Europe"));
5757
}
58+
59+
@Test
60+
public void cypherWithProfileStatements() throws CommandException {
61+
//when
62+
shell.execute("CYPHER RUNTIME=INTERPRETED PROFILE RETURN null");
63+
64+
//then
65+
ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
66+
verify(logger, times(1)).printOut(captor.capture());
67+
68+
List<String> result = captor.getAllValues();
69+
String actual = result.get(0);
70+
// This assertion checks everything except for time and cypher
71+
assertThat(actual, containsString("Plan: \"PROFILE\""));
72+
assertThat(actual, containsString("Statement: \"READ_ONLY\""));
73+
assertThat(actual, containsString("Planner: \"COST\""));
74+
assertThat(actual, containsString("Runtime: \"INTERPRETED\""));
75+
assertThat(actual, containsString("DbHits: 0"));
76+
assertThat(actual, containsString("Rows: 1"));
77+
assertThat(actual, containsString("null"));
78+
assertThat(actual, containsString("NULL"));
79+
}
80+
81+
@Test
82+
public void cypherWithExplainStatements() throws CommandException {
83+
//when
84+
shell.execute("CYPHER RUNTIME=INTERPRETED EXPLAIN RETURN null");
85+
86+
//then
87+
ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
88+
verify(logger, times(1)).printOut(captor.capture());
89+
90+
List<String> result = captor.getAllValues();
91+
String actual = result.get(0);
92+
// This assertion checks everything except for time and cypher
93+
assertThat(actual, containsString("Plan: \"EXPLAIN\""));
94+
assertThat(actual, containsString("Statement: \"READ_ONLY\""));
95+
assertThat(actual, containsString("Planner: \"COST\""));
96+
assertThat(actual, containsString("Runtime: \"INTERPRETED\""));
97+
}
5898
}

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

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -80,46 +80,6 @@ public void cypherWithReturnStatements() throws CommandException {
8080
assertThat(result.get(0), containsString("Added 1 nodes, Set 1 properties, Added 1 labels"));
8181
}
8282

83-
@Test
84-
public void cypherWithProfileStatements() throws CommandException {
85-
//when
86-
shell.execute("CYPHER RUNTIME=INTERPRETED PROFILE RETURN null");
87-
88-
//then
89-
ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
90-
verify(logger, times(1)).printOut(captor.capture());
91-
92-
List<String> result = captor.getAllValues();
93-
String actual = result.get(0);
94-
assertThat(actual, containsString("+------+\n| null |\n+------+\n| NULL |\n+------+"));
95-
assertThat(actual, containsString("| \"PROFILE\" | \"READ_ONLY\" | \"CYPHER 3." ));
96-
assertThat(actual, containsString("| \"COST\" | \"INTERPRETED\" | " ));
97-
assertThat(actual, containsString("| Operator | Estimated Rows | Rows | DB Hits " ));
98-
assertThat(actual, containsString("| Identifiers | Other |" ));
99-
assertThat(actual, containsString("| +Projection | 1 | 1 | 0 " ));
100-
assertThat(actual, containsString("| null | {null : Null()} |" ));
101-
assertThat(actual, containsString("1 row available after "));
102-
}
103-
104-
@Test
105-
public void cypherWithExplainStatements() throws CommandException {
106-
//when
107-
shell.execute("CYPHER RUNTIME=INTERPRETED EXPLAIN RETURN null");
108-
109-
//then
110-
ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
111-
verify(logger, times(1)).printOut(captor.capture());
112-
113-
List<String> result = captor.getAllValues();
114-
String actual = result.get(0);
115-
assertThat(actual, containsString("| \"EXPLAIN\" | \"READ_ONLY\" | \"CYPHER "));
116-
assertThat(actual, containsString("| \"COST\" | \"INTERPRETED\" |"));
117-
assertThat(actual, containsString("| Operator | Estimated Rows | Identifiers | Other |" ));
118-
assertThat(actual, containsString("| +ProduceResults | 1 | null | " ));
119-
assertThat(actual, containsString("| +Projection | 1 | null | {null : Null()} |" ));
120-
assertThat(actual, containsString("0 rows available after "));
121-
}
122-
12383
@Test
12484
public void connectTwiceThrows() throws CommandException {
12585
thrown.expect(CommandException.class);

0 commit comments

Comments
 (0)