Skip to content

Commit 1dc952c

Browse files
authored
test: fix SessionIT, AsyncSessionIT, AsyncTransactionIT run failures (#1697)
1 parent 156d81a commit 1dc952c

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

driver/src/test/java/org/neo4j/driver/integration/SessionIT.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -680,9 +680,9 @@ public String execute(Transaction tx) {
680680
void shouldThrowRunFailureImmediatelyAndCloseSuccessfully() {
681681
assumeTrue(neo4j.isNeo4j44OrEarlier());
682682
try (Session session = neo4j.driver().session()) {
683-
ClientException e = assertThrows(ClientException.class, () -> session.run("RETURN 10 / 0"));
683+
ClientException e = assertThrows(ClientException.class, () -> session.run("not query"));
684684

685-
assertThat(e.getMessage(), containsString("/ by zero"));
685+
assertThat(e.getMessage(), containsString("not query"));
686686
}
687687
}
688688

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

717-
assertThat(e.getMessage(), containsString("/ by zero"));
717+
assertThat(e.getMessage(), containsString("not query"));
718718
}
719719
}
720720

@@ -724,8 +724,8 @@ void shouldThrowRunFailureImmediatelyAndAcceptSubsequentRun() {
724724
try (Session session = neo4j.driver().session()) {
725725
session.run("CREATE ()");
726726
session.run("CREATE ()");
727-
ClientException e = assertThrows(ClientException.class, () -> session.run("RETURN 10 / 0"));
728-
assertThat(e.getMessage(), containsString("/ by zero"));
727+
ClientException e = assertThrows(ClientException.class, () -> session.run("not query"));
728+
assertThat(e.getMessage(), containsString("not query"));
729729
session.run("CREATE ()");
730730
}
731731
}
@@ -737,8 +737,8 @@ void shouldCloseCleanlyWhenRunErrorConsumed() {
737737
session.run("CREATE ()");
738738

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

743743
session.run("CREATE ()");
744744

driver/src/test/java/org/neo4j/driver/integration/async/AsyncSessionIT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -648,17 +648,17 @@ public CompletionStage<String> execute(AsyncTransaction tx) {
648648
@Test
649649
void shouldNotPropagateRunFailureWhenClosed() {
650650
assumeTrue(neo4j.isNeo4j44OrEarlier());
651-
session.runAsync("RETURN 10 / 0");
651+
session.runAsync("not query");
652652

653653
await(session.closeAsync());
654654
}
655655

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

661-
assertThat(e.getMessage(), containsString("/ by zero"));
661+
assertThat(e.getMessage(), containsString("not query"));
662662
}
663663

664664
@Test

driver/src/test/java/org/neo4j/driver/integration/async/AsyncTransactionIT.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ void shouldFailToCommitWhenQueriesFail() {
617617

618618
tx.runAsync("CREATE (:TestNode)");
619619
tx.runAsync("CREATE (:TestNode)");
620-
tx.runAsync("RETURN 10 / 0");
620+
tx.runAsync("not query");
621621
tx.runAsync("CREATE (:TestNode)");
622622

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

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

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

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

670670
await(tx.rollbackAsync());
671671
}

0 commit comments

Comments
 (0)