From 8b86bea3b3f3ed835430e7e23811729869b5af3a Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Sat, 6 Jun 2015 20:37:56 +0200 Subject: [PATCH] Add test for byte array codec #70 --- .../java/com/lambdaworks/redis/CustomCodecTest.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/test/java/com/lambdaworks/redis/CustomCodecTest.java b/src/test/java/com/lambdaworks/redis/CustomCodecTest.java index d6e36fb88e..12544454f4 100644 --- a/src/test/java/com/lambdaworks/redis/CustomCodecTest.java +++ b/src/test/java/com/lambdaworks/redis/CustomCodecTest.java @@ -13,6 +13,7 @@ import java.nio.charset.Charset; import java.util.List; +import com.lambdaworks.redis.codec.ByteArrayCodec; import org.junit.Test; import com.lambdaworks.redis.codec.RedisCodec; @@ -26,6 +27,17 @@ public void test() throws Exception { assertThat(connection.get(key)).isEqualTo(list); } + @Test + public void testByteCodec() throws Exception { + RedisConnection connection = client.connect(new ByteArrayCodec()); + String value = "üöäü+#"; + connection.set(key.getBytes(), value.getBytes()); + assertThat(connection.get(key.getBytes())).isEqualTo(value.getBytes()); + + List keys = connection.keys(key.getBytes()); + assertThat(keys).contains(key.getBytes()); + } + public class SerializedObjectCodec extends RedisCodec { private Charset charset = Charset.forName("UTF-8");