@@ -230,7 +230,7 @@ void shouldConsiderWriter() {
230
230
GenericJackson2JsonRedisSerializer serializer = new GenericJackson2JsonRedisSerializer ((String ) null ,
231
231
JacksonObjectReader .create (), (mapper , source ) -> {
232
232
return mapper .writerWithView (Views .Basic .class ).writeValueAsBytes (source );
233
- });
233
+ }, null );
234
234
235
235
byte [] result = serializer .serialize (user );
236
236
@@ -269,7 +269,7 @@ void shouldConsiderReader() {
269
269
return mapper .readerWithView (Views .Basic .class ).forType (type ).readValue (source );
270
270
}
271
271
return mapper .readValue (source , type );
272
- }, JacksonObjectWriter .create ());
272
+ }, JacksonObjectWriter .create (), null );
273
273
274
274
byte [] serializedValue = serializer .serialize (user );
275
275
@@ -420,7 +420,7 @@ void deserializesJavaTimeFrimBytes() {
420
420
}
421
421
422
422
@ Test // GH-2601
423
- public void internalObjectMapperCustomization () {
423
+ void internalObjectMapperCustomization () {
424
424
425
425
GenericJackson2JsonRedisSerializer serializer = new GenericJackson2JsonRedisSerializer ();
426
426
@@ -438,14 +438,28 @@ public void internalObjectMapperCustomization() {
438
438
}
439
439
440
440
@ Test // GH-2601
441
- public void configureWithNullConsumerThrowsIllegalArgumentException () {
441
+ void configureWithNullConsumerThrowsIllegalArgumentException () {
442
442
443
443
assertThatIllegalArgumentException ()
444
444
.isThrownBy (() -> new GenericJackson2JsonRedisSerializer ().configure (null ))
445
445
.withMessage ("Consumer used to configure and customize ObjectMapper must not be null" )
446
446
.withNoCause ();
447
447
}
448
448
449
+ @ Test
450
+ void customSerializeAndDeserializeNullValue () {
451
+
452
+ GenericJackson2JsonRedisSerializer serializer = new GenericJackson2JsonRedisSerializer ();
453
+
454
+ NullValue nv = BeanUtils .instantiateClass (NullValue .class );
455
+
456
+ byte [] serializedValue = serializer .serialize (nv );
457
+ assertThat (serializedValue ).isNotNull ();
458
+
459
+ Object deserializedValue = serializer .deserialize (serializedValue );
460
+ assertThat (deserializedValue ).isInstanceOf (NullValue .class );
461
+ }
462
+
449
463
private static void serializeAndDeserializeNullValue (GenericJackson2JsonRedisSerializer serializer ) {
450
464
451
465
NullValue nv = BeanUtils .instantiateClass (NullValue .class );
0 commit comments