use of org.redisson.codec.JsonJacksonCodec in project redisson by redisson.
the class RedissonMapCacheTest method testDeserializationErrorReturnsErrorImmediately.
@Test(timeout = 5000)
public void testDeserializationErrorReturnsErrorImmediately() throws Exception {
redisson.getConfig().setCodec(new JsonJacksonCodec());
RMapCache<String, SimpleObjectWithoutDefaultConstructor> map = redisson.getMapCache("deserializationFailure");
SimpleObjectWithoutDefaultConstructor object = new SimpleObjectWithoutDefaultConstructor("test-val");
Assert.assertEquals("test-val", object.getTestField());
map.put("test-key", object);
try {
map.get("test-key");
Assert.fail("Expected exception from map.get() call");
} catch (Exception e) {
e.printStackTrace();
}
}
use of org.redisson.codec.JsonJacksonCodec in project redisson by redisson.
the class RedissonMapTest method testDeserializationErrorReturnsErrorImmediately.
@Test(timeout = 5000)
public void testDeserializationErrorReturnsErrorImmediately() throws Exception {
redisson.getConfig().setCodec(new JsonJacksonCodec());
RMap<String, SimpleObjectWithoutDefaultConstructor> map = redisson.getMap("deserializationFailure");
SimpleObjectWithoutDefaultConstructor object = new SimpleObjectWithoutDefaultConstructor("test-val");
Assert.assertEquals("test-val", object.getTestField());
map.put("test-key", object);
try {
map.get("test-key");
Assert.fail("Expected exception from map.get() call");
} catch (Exception e) {
e.printStackTrace();
}
}
use of org.redisson.codec.JsonJacksonCodec in project redisson by redisson.
the class RedissonCodecTest method testListOfStrings.
@Test
public void testListOfStrings() {
Config config = createConfig();
config.setCodec(new JsonJacksonCodec());
RedissonClient redisson = Redisson.create(config);
RMap<String, List<String>> map = redisson.getMap("list of strings", jsonListOfStringCodec);
map.put("foo", new ArrayList<String>(Arrays.asList("bar")));
RMap<String, List<String>> map2 = redisson.getMap("list of strings", jsonListOfStringCodec);
assertThat(map2).isEqualTo(map);
redisson.shutdown();
}
Aggregations