Skip to content

Commit 6b187e4

Browse files
committed
Dispatch empty query to server
This update ensures that empty query gets dispatched to server and expects it to handle it accordingly.
1 parent df8b781 commit 6b187e4

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

driver/src/main/java/org/neo4j/driver/Query.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
import org.neo4j.driver.util.Immutable;
2626

2727
import static java.lang.String.format;
28-
import static org.neo4j.driver.internal.util.Iterables.newHashMapWithSize;
29-
import static org.neo4j.driver.internal.util.Preconditions.checkArgument;
3028
import static org.neo4j.driver.Values.ofValue;
3129
import static org.neo4j.driver.Values.value;
30+
import static org.neo4j.driver.internal.util.Iterables.newHashMapWithSize;
31+
import static org.neo4j.driver.internal.util.Preconditions.checkArgument;
3232

3333
/**
3434
* The components of a Cypher query, containing the query text and parameter map.
@@ -201,7 +201,6 @@ public String toString()
201201
private static String validateQueryText(String query )
202202
{
203203
checkArgument( query != null, "Cypher query text should not be null" );
204-
checkArgument( !query.isEmpty(), "Cypher query text should not be an empty string" );
205204
return query;
206205
}
207206
}

driver/src/test/java/org/neo4j/driver/QueryTest.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
import static org.hamcrest.Matchers.equalTo;
2727
import static org.hamcrest.junit.MatcherAssert.assertThat;
28+
import static org.junit.jupiter.api.Assertions.assertNotNull;
2829
import static org.junit.jupiter.api.Assertions.assertThrows;
2930
import static org.neo4j.driver.Values.parameters;
3031

@@ -121,8 +122,12 @@ void shouldProhibitNullQuery()
121122
}
122123

123124
@Test
124-
void shouldProhibitEmptyQuery()
125+
void shouldAcceptEmptyQuery()
125126
{
126-
assertThrows( IllegalArgumentException.class, () -> new Query( "" ) );
127+
// when
128+
Query query = new Query( "" );
129+
130+
// then
131+
assertNotNull( query );
127132
}
128133
}

0 commit comments

Comments
 (0)