Skip to content

Commit

Permalink
Add test for byte array codec #70
Browse files Browse the repository at this point in the history
  • Loading branch information
mp911de committed Jun 6, 2015
1 parent 4f6020f commit d899e05
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/test/java/com/lambdaworks/redis/CustomCodecTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -26,6 +27,17 @@ public void test() throws Exception {
assertThat(connection.get(key)).isEqualTo(list);
}

@Test
public void testByteCodec() throws Exception {
RedisConnection<byte[], byte[]> connection = client.connect(new ByteArrayCodec());
String value = "üöäü+#";
connection.set(key.getBytes(), value.getBytes());
assertThat(connection.get(key.getBytes())).isEqualTo(value.getBytes());

List<byte[]> keys = connection.keys(key.getBytes());
assertThat(keys).contains(key.getBytes());
}

public class SerializedObjectCodec extends RedisCodec<String, Object> {
private Charset charset = Charset.forName("UTF-8");

Expand Down

0 comments on commit d899e05

Please sign in to comment.