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
177177 out .writeByte ( value ? TRUE : FALSE );
178178 }
179179
180+ public void pack ( char value ) throws IOException
181+ {
182+ pack ( String .valueOf (value ) );
183+ }
184+
180185 public void pack ( long value ) throws IOException
181186 {
182187 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 )
207207 return new ListValue ( values .toArray ( new Value [values .size ()] ) );
208208 }
209209
210+ public static Value value (final char val ) { return new StringValue ( String .valueOf (val ) ); }
211+
210212 public static Value value ( final String val )
211213 {
212214 return new StringValue ( val );
Original file line number Diff line number Diff line change @@ -118,6 +118,9 @@ public void equalityRules() throws Throwable
118118 assertNotEquals ( value ( "Hello" ), value ( "hello" ) );
119119 assertNotEquals ( value ( "This åäö string ?? contains strange " ),
120120 value ( "This åäö string ?? contains strange Ü" ) );
121+
122+ assertEquals ( value ( 'A' ), value ( 'A' ));
123+ assertEquals ( value ( 'A' ), value ( "A" ));
121124 }
122125
123126 @ Test
Original file line number Diff line number Diff line change @@ -395,6 +395,26 @@ public void testCanPackAndUnpackBytes() throws Throwable
395395
396396 }
397397
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+
398418 @ Test
399419 public void testCanPackAndUnpackString () throws Throwable
400420 {
You can’t perform that action at this time.
0 commit comments