Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions driver/src/test/java/org/neo4j/driver/integration/SessionIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -680,9 +680,9 @@ public String execute(Transaction tx) {
void shouldThrowRunFailureImmediatelyAndCloseSuccessfully() {
assumeTrue(neo4j.isNeo4j44OrEarlier());
try (Session session = neo4j.driver().session()) {
ClientException e = assertThrows(ClientException.class, () -> session.run("RETURN 10 / 0"));
ClientException e = assertThrows(ClientException.class, () -> session.run("not query"));

assertThat(e.getMessage(), containsString("/ by zero"));
assertThat(e.getMessage(), containsString("not query"));
}
}

Expand Down Expand Up @@ -712,9 +712,9 @@ void shouldThrowRunFailureImmediatelyAfterMultipleSuccessfulRunsAndCloseSuccessf
try (Session session = neo4j.driver().session()) {
session.run("CREATE ()");
session.run("CREATE ()");
ClientException e = assertThrows(ClientException.class, () -> session.run("RETURN 10 / 0"));
ClientException e = assertThrows(ClientException.class, () -> session.run("not query"));

assertThat(e.getMessage(), containsString("/ by zero"));
assertThat(e.getMessage(), containsString("not query"));
}
}

Expand All @@ -724,8 +724,8 @@ void shouldThrowRunFailureImmediatelyAndAcceptSubsequentRun() {
try (Session session = neo4j.driver().session()) {
session.run("CREATE ()");
session.run("CREATE ()");
ClientException e = assertThrows(ClientException.class, () -> session.run("RETURN 10 / 0"));
assertThat(e.getMessage(), containsString("/ by zero"));
ClientException e = assertThrows(ClientException.class, () -> session.run("not query"));
assertThat(e.getMessage(), containsString("not query"));
session.run("CREATE ()");
}
}
Expand All @@ -737,8 +737,8 @@ void shouldCloseCleanlyWhenRunErrorConsumed() {
session.run("CREATE ()");

ClientException e = assertThrows(
ClientException.class, () -> session.run("RETURN 10 / 0").consume());
assertThat(e.getMessage(), containsString("/ by zero"));
ClientException.class, () -> session.run("not query").consume());
assertThat(e.getMessage(), containsString("not query"));

session.run("CREATE ()");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -648,17 +648,17 @@ public CompletionStage<String> execute(AsyncTransaction tx) {
@Test
void shouldNotPropagateRunFailureWhenClosed() {
assumeTrue(neo4j.isNeo4j44OrEarlier());
session.runAsync("RETURN 10 / 0");
session.runAsync("not query");

await(session.closeAsync());
}

@Test
void shouldPropagateRunFailureImmediately() {
assumeTrue(neo4j.isNeo4j44OrEarlier());
ClientException e = assertThrows(ClientException.class, () -> await(session.runAsync("RETURN 10 / 0")));
ClientException e = assertThrows(ClientException.class, () -> await(session.runAsync("not query")));

assertThat(e.getMessage(), containsString("/ by zero"));
assertThat(e.getMessage(), containsString("not query"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ void shouldFailToCommitWhenQueriesFail() {

tx.runAsync("CREATE (:TestNode)");
tx.runAsync("CREATE (:TestNode)");
tx.runAsync("RETURN 10 / 0");
tx.runAsync("not query");
tx.runAsync("CREATE (:TestNode)");

ClientException e = assertThrows(ClientException.class, () -> await(tx.commitAsync()));
Expand All @@ -643,10 +643,10 @@ void shouldFailToCommitWhenBlockedRunFailed() {
assumeTrue(neo4j.isNeo4j44OrEarlier());
AsyncTransaction tx = await(session.beginTransactionAsync());

ClientException runException = assertThrows(ClientException.class, () -> await(tx.runAsync("RETURN 42 / 0")));
ClientException runException = assertThrows(ClientException.class, () -> await(tx.runAsync("not query")));

ClientException commitException = assertThrows(ClientException.class, () -> await(tx.commitAsync()));
assertThat(runException.getMessage(), containsString("/ by zero"));
assertThat(runException.getMessage(), containsString("not query"));
assertNoCircularReferences(commitException);
assertThat(commitException.getMessage(), containsString("Transaction can't be committed"));
}
Expand All @@ -665,7 +665,7 @@ void shouldRollbackSuccessfullyWhenBlockedRunFailed() {
assumeTrue(neo4j.isNeo4j44OrEarlier());
AsyncTransaction tx = await(session.beginTransactionAsync());

assertThrows(ClientException.class, () -> await(tx.runAsync("RETURN 42 / 0")));
assertThrows(ClientException.class, () -> await(tx.runAsync("not query")));

await(tx.rollbackAsync());
}
Expand Down