File tree Expand file tree Collapse file tree 2 files changed +44
-3
lines changed
main/java/org/neo4j/driver/internal
test/java/org/neo4j/driver/v1/integration Expand file tree Collapse file tree 2 files changed +44
-3
lines changed Original file line number Diff line number Diff line change @@ -69,14 +69,15 @@ public StatementResult run( String statementText )
6969 @ Override
7070 public StatementResult run ( String statementText , Map <String , Object > statementParameters )
7171 {
72- return run ( statementText , value ( statementParameters ) );
72+ Value params = statementParameters == null ? Values .EmptyMap : value (statementParameters );
73+ return run ( statementText , params );
7374 }
7475
7576 @ Override
7677 public StatementResult run ( String statementTemplate , Record statementParameters )
7778 {
78- // TODO: This conversion to map here is pointless, it gets converted right back
79- return run ( statementTemplate , statementParameters . asMap () );
79+ Value params = statementParameters == null ? Values . EmptyMap : value ( statementParameters . asMap () );
80+ return run ( statementTemplate , params );
8081 }
8182
8283 @ Override
Original file line number Diff line number Diff line change 2424import java .util .Collections ;
2525import java .util .Iterator ;
2626import java .util .List ;
27+ import java .util .Map ;
2728
2829import org .neo4j .driver .v1 .Record ;
2930import org .neo4j .driver .v1 .StatementResult ;
@@ -74,6 +75,45 @@ public void shouldRunWithParameters() throws Throwable
7475 // Then nothing should've failed
7576 }
7677
78+ @ SuppressWarnings ( "ConstantConditions" )
79+ @ Test
80+ public void shouldRunWithNullValuesAsParameters () throws Throwable
81+ {
82+ // Given
83+ Value params = null ;
84+
85+ // When
86+ session .run ( "CREATE (n:FirstNode {name:'Steven'})" , params );
87+
88+ // Then nothing should've failed
89+ }
90+
91+ @ SuppressWarnings ( "ConstantConditions" )
92+ @ Test
93+ public void shouldRunWithNullRecordAsParameters () throws Throwable
94+ {
95+ // Given
96+ Record params = null ;
97+
98+ // When
99+ session .run ( "CREATE (n:FirstNode {name:'Steven'})" , params );
100+
101+ // Then nothing should've failed
102+ }
103+
104+ @ SuppressWarnings ( "ConstantConditions" )
105+ @ Test
106+ public void shouldRunWithNullMapAsParameters () throws Throwable
107+ {
108+ // Given
109+ Map <String , Object > params = null ;
110+
111+ // When
112+ session .run ( "CREATE (n:FirstNode {name:'Steven'})" , params );
113+
114+ // Then nothing should've failed
115+ }
116+
77117 @ Test
78118 public void shouldRunWithCollectionAsParameter () throws Throwable
79119 {
You can’t perform that action at this time.
0 commit comments