use of redis.clients.jedis.exceptions.JedisDataException in project ignite by apache.
the class RedisProtocolStringSelfTest method testGetRange.
/**
* @throws Exception If failed.
*/
public void testGetRange() throws Exception {
try (Jedis jedis = pool.getResource()) {
Assert.assertEquals("", jedis.getrange("getRangeKeyNonExisting", 0, 0));
jcache().put("getRangeKey", "This is a string");
Assert.assertEquals("This", jedis.getrange("getRangeKey", 0, 3));
Assert.assertEquals("ing", jedis.getrange("getRangeKey", -3, -1));
Assert.assertEquals("This is a string", jedis.getrange("getRangeKey", 0, -1));
Assert.assertEquals("string", jedis.getrange("getRangeKey", 10, 100));
jcache().put("setDataTypeKey", new HashSet<String>(Arrays.asList("1", "2")));
try {
jedis.getrange("setDataTypeKey", 0, 1);
assert false : "Exception has to be thrown!";
} catch (JedisDataException e) {
assertTrue(e.getMessage().startsWith("WRONGTYPE"));
}
}
}
Aggregations