File tree Expand file tree Collapse file tree 4 files changed +30
-0
lines changed
main/java/org/neo4j/driver
test/java/org/neo4j/driver/internal Expand file tree Collapse file tree 4 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -177,6 +177,11 @@ public void pack( boolean value ) throws IOException
177
177
out .writeByte ( value ? TRUE : FALSE );
178
178
}
179
179
180
+ public void pack ( char value ) throws IOException
181
+ {
182
+ pack ( String .valueOf (value ) );
183
+ }
184
+
180
185
public void pack ( long value ) throws IOException
181
186
{
182
187
if ( value >= MINUS_2_TO_THE_4 && value < PLUS_2_TO_THE_7 )
Original file line number Diff line number Diff line change @@ -207,6 +207,8 @@ public static Value value( Iterator<Object> val )
207
207
return new ListValue ( values .toArray ( new Value [values .size ()] ) );
208
208
}
209
209
210
+ public static Value value (final char val ) { return new StringValue ( String .valueOf (val ) ); }
211
+
210
212
public static Value value ( final String val )
211
213
{
212
214
return new StringValue ( val );
Original file line number Diff line number Diff line change @@ -118,6 +118,9 @@ public void equalityRules() throws Throwable
118
118
assertNotEquals ( value ( "Hello" ), value ( "hello" ) );
119
119
assertNotEquals ( value ( "This åäö string ?? contains strange " ),
120
120
value ( "This åäö string ?? contains strange Ü" ) );
121
+
122
+ assertEquals ( value ( 'A' ), value ( 'A' ));
123
+ assertEquals ( value ( 'A' ), value ( "A" ));
121
124
}
122
125
123
126
@ Test
Original file line number Diff line number Diff line change @@ -395,6 +395,26 @@ public void testCanPackAndUnpackBytes() throws Throwable
395
395
396
396
}
397
397
398
+ @ Test
399
+ public void testCanPackAndUnpackChar () throws Throwable
400
+ {
401
+ // Given
402
+ Machine machine = new Machine ();
403
+
404
+ // When
405
+ PackStream .Packer packer = machine .packer ();
406
+ packer .pack ( 'A' );
407
+ packer .flush ();
408
+
409
+ // Then
410
+ PackStream .Unpacker unpacker = newUnpacker ( machine .output () );
411
+ PackType packType = unpacker .peekNextType ();
412
+
413
+ // Then
414
+ assertThat ( packType , equalTo ( PackType .STRING ) );
415
+ assertThat ( unpacker .unpackString (), equalTo ( "A" ));
416
+ }
417
+
398
418
@ Test
399
419
public void testCanPackAndUnpackString () throws Throwable
400
420
{
You can’t perform that action at this time.
0 commit comments