diff --git a/spring-data-redis/src/test/java/org/springframework/data/keyvalue/redis/support/collections/RedisMapTests.java b/spring-data-redis/src/test/java/org/springframework/data/keyvalue/redis/support/collections/RedisMapTests.java index dc6b9d2ff..166c737dd 100644 --- a/spring-data-redis/src/test/java/org/springframework/data/keyvalue/redis/support/collections/RedisMapTests.java +++ b/spring-data-redis/src/test/java/org/springframework/data/keyvalue/redis/support/collections/RedisMapTests.java @@ -24,6 +24,7 @@ import org.springframework.data.keyvalue.redis.SettingsUtils; import org.springframework.data.keyvalue.redis.connection.jedis.JedisConnectionFactory; import org.springframework.data.keyvalue.redis.connection.jredis.JredisConnectionFactory; import org.springframework.data.keyvalue.redis.core.RedisTemplate; +import org.springframework.data.keyvalue.redis.serializer.JacksonJsonRedisSerializer; import org.springframework.data.keyvalue.redis.serializer.OxmSerializer; import org.springframework.oxm.xstream.XStreamMarshaller; @@ -54,7 +55,7 @@ public class RedisMapTests extends AbstractRedisMapTests { throw new RuntimeException("Cannot init XStream", ex); } OxmSerializer serializer = new OxmSerializer(xstream, xstream); - + JacksonJsonRedisSerializer jsonSerializer = new JacksonJsonRedisSerializer(Person.class); // create Jedis Factory ObjectFactory stringFactory = new StringObjectFactory(); @@ -75,6 +76,10 @@ public class RedisMapTests extends AbstractRedisMapTests { xstreamGenericTemplate.setDefaultSerializer(serializer); xstreamGenericTemplate.afterPropertiesSet(); + // json + RedisTemplate jsonPersonTemplate = new RedisTemplate(jedisConnFactory); + jsonPersonTemplate.setValueSerializer(jsonSerializer); + JredisConnectionFactory jredisConnFactory = new JredisConnectionFactory(); jredisConnFactory.setUsePool(true); @@ -95,6 +100,10 @@ public class RedisMapTests extends AbstractRedisMapTests { RedisTemplate xstreamPersonTemplateJR = new RedisTemplate(jredisConnFactory); xstreamPersonTemplateJR.setValueSerializer(serializer); + // json JR + RedisTemplate jsonPersonTemplateJR = new RedisTemplate(jredisConnFactory); + jsonPersonTemplate.setValueSerializer(jsonSerializer); + return Arrays.asList(new Object[][] { { stringFactory, stringFactory, genericTemplate }, { personFactory, personFactory, genericTemplate }, { stringFactory, personFactory, genericTemplate }, @@ -104,6 +113,10 @@ public class RedisMapTests extends AbstractRedisMapTests { { personFactory, personFactory, genericTemplateJR }, { stringFactory, personFactory, genericTemplateJR }, { personFactory, stringFactory, genericTemplateJR }, - { personFactory, stringFactory, xGenericTemplateJR } }); + { personFactory, stringFactory, xGenericTemplateJR }, + { personFactory, personFactory, jsonPersonTemplate }, + { personFactory, stringFactory, jsonPersonTemplate }, + { personFactory, personFactory, jsonPersonTemplateJR }, + { personFactory, stringFactory, jsonPersonTemplateJR } }); } } \ No newline at end of file