Skip to content

Commit 664cefa

Browse files
committed
test: fix SessionIT, AsyncSessionIT, AsyncTransactionIT run failures
1 parent 156d81a commit 664cefa

File tree

4 files changed

+78
-15
lines changed

4 files changed

+78
-15
lines changed

bom/.flattened-pom.xml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>org.neo4j.driver</groupId>
6+
<artifactId>neo4j-java-driver-bom</artifactId>
7+
<version>6.0-SNAPSHOT</version>
8+
<packaging>pom</packaging>
9+
<name>Neo4j Java Driver (BOM)</name>
10+
<description>The BOM for the Neo4j Java Driver</description>
11+
<url>https://github.com/neo4j/neo4j-java-driver</url>
12+
<licenses>
13+
<license>
14+
<name>Apache License, Version 2</name>
15+
<url>http://www.apache.org/licenses/LICENSE-2.0</url>
16+
</license>
17+
</licenses>
18+
<developers>
19+
<developer>
20+
<id>neo4j</id>
21+
<name>The Neo4j Team</name>
22+
<url>http://www.neo4j.com/</url>
23+
<organization>Neo4j Sweden AB</organization>
24+
<organizationUrl>http://www.neo4j.com/</organizationUrl>
25+
</developer>
26+
</developers>
27+
<scm>
28+
<connection>scm:git:git://github.com/neo4j/neo4j-java-driver.git</connection>
29+
<developerConnection>scm:git:git@github.com:neo4j/neo4j-java-driver.git</developerConnection>
30+
<url>https://github.com/neo4j/neo4j-java-driver</url>
31+
</scm>
32+
<dependencyManagement>
33+
<dependencies>
34+
<dependency>
35+
<groupId>org.neo4j.driver</groupId>
36+
<artifactId>neo4j-java-driver</artifactId>
37+
<version>6.0-SNAPSHOT</version>
38+
</dependency>
39+
<dependency>
40+
<groupId>org.neo4j.driver</groupId>
41+
<artifactId>neo4j-java-driver-all</artifactId>
42+
<version>6.0-SNAPSHOT</version>
43+
</dependency>
44+
<dependency>
45+
<groupId>org.neo4j.driver</groupId>
46+
<artifactId>neo4j-java-driver-observation-metrics</artifactId>
47+
<version>6.0-SNAPSHOT</version>
48+
</dependency>
49+
<dependency>
50+
<groupId>org.neo4j.driver</groupId>
51+
<artifactId>neo4j-java-driver-observation-micrometer</artifactId>
52+
<version>6.0-SNAPSHOT</version>
53+
</dependency>
54+
<dependency>
55+
<groupId>org.neo4j.bolt</groupId>
56+
<artifactId>neo4j-bolt-connection-bom</artifactId>
57+
<version>8.3.0</version>
58+
<type>pom</type>
59+
<scope>import</scope>
60+
</dependency>
61+
</dependencies>
62+
</dependencyManagement>
63+
</project>

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)