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 )
69
69
@ Override
70
70
public StatementResult run ( String statementText , Map <String , Object > statementParameters )
71
71
{
72
- return run ( statementText , value ( statementParameters ) );
72
+ Value params = statementParameters == null ? Values .EmptyMap : value (statementParameters );
73
+ return run ( statementText , params );
73
74
}
74
75
75
76
@ Override
76
77
public StatementResult run ( String statementTemplate , Record statementParameters )
77
78
{
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 );
80
81
}
81
82
82
83
@ Override
Original file line number Diff line number Diff line change 24
24
import java .util .Collections ;
25
25
import java .util .Iterator ;
26
26
import java .util .List ;
27
+ import java .util .Map ;
27
28
28
29
import org .neo4j .driver .v1 .Record ;
29
30
import org .neo4j .driver .v1 .StatementResult ;
@@ -74,6 +75,45 @@ public void shouldRunWithParameters() throws Throwable
74
75
// Then nothing should've failed
75
76
}
76
77
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
+
77
117
@ Test
78
118
public void shouldRunWithCollectionAsParameter () throws Throwable
79
119
{
You can’t perform that action at this time.
0 commit comments