use of org.redisson.api.RLexSortedSet in project redisson by redisson.
the class RedissonScoredSortedSetTest method testLexSortedSet.
@Test
public void testLexSortedSet() {
RLexSortedSet set = redisson.getLexSortedSet("simple");
set.add("a");
set.add("b");
set.add("c");
set.add("d");
set.add("e");
Collection<String> r = set.range("b", true, "e", false, 1, 2);
String[] a = r.toArray(new String[0]);
Assert.assertArrayEquals(new String[] { "c", "d" }, a);
}
use of org.redisson.api.RLexSortedSet in project redisson by redisson.
the class RedissonLexSortedSetTest method testLexRange.
@Test
public void testLexRange() {
RLexSortedSet set = redisson.getLexSortedSet("simple");
set.add("a");
set.add("b");
set.add("c");
set.add("d");
set.add("e");
set.add("f");
set.add("g");
assertThat(set.range("aaa", true, "g", false)).containsExactly("b", "c", "d", "e", "f");
assertThat(set.range("aaa", true, "g", false, 2, 3)).containsExactly("d", "e", "f");
}
use of org.redisson.api.RLexSortedSet in project redisson by redisson.
the class RedissonLexSortedSetTest method testAll.
@Test
public void testAll() {
RLexSortedSet set = redisson.getLexSortedSet("simple");
set.addAll(Arrays.asList("foo", "bar"));
assertThat(set.contains("foo")).isTrue();
assertThat(set.contains("bar")).isTrue();
assertThat(set.contains("123")).isFalse();
}
use of org.redisson.api.RLexSortedSet in project redisson by redisson.
the class RedissonLexSortedSetTest method testLexRangeTail.
@Test
public void testLexRangeTail() {
RLexSortedSet set = redisson.getLexSortedSet("simple");
Assertions.assertTrue(set.add("a"));
Assertions.assertFalse(set.add("a"));
Assertions.assertTrue(set.add("b"));
Assertions.assertTrue(set.add("c"));
Assertions.assertTrue(set.add("d"));
Assertions.assertTrue(set.add("e"));
Assertions.assertTrue(set.add("f"));
Assertions.assertTrue(set.add("g"));
assertThat(set.rangeTail("c", false)).containsExactly("d", "e", "f", "g");
assertThat(set.rangeTail("c", true)).containsExactly("c", "d", "e", "f", "g");
assertThat(set.rangeTail("c", false, 1, 2)).containsExactly("e", "f");
assertThat(set.rangeTail("c", true, 1, 3)).containsExactly("d", "e", "f");
}
use of org.redisson.api.RLexSortedSet in project redisson by redisson.
the class RedissonLexSortedSetTest method testLexRangeHeadReversed.
@Test
public void testLexRangeHeadReversed() {
RLexSortedSet set = redisson.getLexSortedSet("simple");
set.add("a");
set.add("b");
set.add("c");
set.add("d");
set.add("e");
set.add("f");
set.add("g");
assertThat(set.rangeHeadReversed("c", false)).containsExactly("b", "a");
assertThat(set.rangeHeadReversed("c", true)).containsExactly("c", "b", "a");
assertThat(set.rangeHeadReversed("c", false, 1, 1)).containsExactly("a");
assertThat(set.rangeHeadReversed("c", true, 1, 2)).containsExactly("b", "a");
}
Aggregations