Skip to content

Commit

Permalink
testStringCodec added
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita committed Feb 4, 2016
1 parent 1cad273 commit e81f148
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/test/java/org/redisson/RedissonMapTest.java
Expand Up @@ -3,6 +3,7 @@
import static org.assertj.core.api.Assertions.assertThat;

import java.io.Serializable;
import java.util.AbstractMap;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
Expand All @@ -13,10 +14,12 @@
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ExecutionException;

import org.assertj.core.data.MapEntry;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Assert;
import org.junit.Test;
import org.redisson.client.codec.StringCodec;
import org.redisson.codec.JsonJacksonCodec;
import org.redisson.core.Predicate;
import org.redisson.core.RMap;
Expand Down Expand Up @@ -205,6 +208,25 @@ public boolean apply(Integer input) {
assertThat(filtered).isEqualTo(expectedMap);
}

@Test
public void testStringCodec() {
Config config = createConfig();
config.setCodec(StringCodec.INSTANCE);
RedissonClient redisson = Redisson.create(config);

RMap<String, String> rmap = redisson.getMap("TestRMap01");
rmap.put("A", "1");
rmap.put("B", "2");

Iterator<Map.Entry<String, String>> iterator = rmap.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, String> next = iterator.next();
assertThat(next).isIn(new AbstractMap.SimpleEntry("A", "1"), new AbstractMap.SimpleEntry("B", "2"));
}

redisson.shutdown();
}

@Test
public void testInteger() {
Map<Integer, Integer> map = redisson.getMap("test_int");
Expand Down

0 comments on commit e81f148

Please sign in to comment.