DATAREDIS-729 - Expose reverseRangeByLex methods on Template API.
Also, switch methods to default methods where applicable. Original pull request: #566.
This commit is contained in:
@@ -247,9 +247,29 @@ public class DefaultZSetOperationsTests<K, V> {
|
||||
zSetOps.add(key, value2, 3.7);
|
||||
zSetOps.add(key, value3, 5.8);
|
||||
Set<V> tuples = zSetOps.rangeByLex(key, RedisZSetCommands.Range.unbounded(),
|
||||
RedisZSetCommands.Limit.limit().count(1).offset(1));
|
||||
RedisZSetCommands.Limit.limit().count(2).offset(1));
|
||||
|
||||
assertThat(tuples).hasSize(1).startsWith(value2);
|
||||
assertThat(tuples).hasSize(2).containsSequence(value2, value3);
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-729
|
||||
public void testReverseRangeByLexUnboundedWithLimit() {
|
||||
|
||||
assumeThat(valueFactory).isOfAnyClassIn(DoubleObjectFactory.class, DoubleAsStringObjectFactory.class,
|
||||
LongAsStringObjectFactory.class, LongObjectFactory.class);
|
||||
|
||||
K key = keyFactory.instance();
|
||||
V value1 = valueFactory.instance();
|
||||
V value2 = valueFactory.instance();
|
||||
V value3 = valueFactory.instance();
|
||||
|
||||
zSetOps.add(key, value1, 1.9);
|
||||
zSetOps.add(key, value2, 3.7);
|
||||
zSetOps.add(key, value3, 5.8);
|
||||
Set<V> tuples = zSetOps.reverseRangeByLex(key, RedisZSetCommands.Range.unbounded(),
|
||||
RedisZSetCommands.Limit.limit().count(2).offset(1));
|
||||
|
||||
assertThat(tuples).hasSize(2).containsSequence(value2, value1);
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-407
|
||||
|
||||
@@ -402,14 +402,31 @@ public abstract class AbstractRedisZSetTest<T> extends AbstractRedisCollectionTe
|
||||
zSet.add(t2, 2);
|
||||
zSet.add(t3, 3);
|
||||
Set<T> tuples = zSet.rangeByLex(RedisZSetCommands.Range.range().gte(t1),
|
||||
RedisZSetCommands.Limit.limit().count(1).offset(1));
|
||||
RedisZSetCommands.Limit.limit().count(2).offset(1));
|
||||
|
||||
assertThat(tuples.size()).isEqualTo(1);
|
||||
T tuple = tuples.iterator().next();
|
||||
assertThat(tuple).isEqualTo(t2);
|
||||
assertThat(tuples).hasSize(2).containsSequence(t2, t3);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // DATAREDIS-729
|
||||
public void testReverseRangeByLexBoundedWithLimit() {
|
||||
|
||||
assumeThat(factory).isOfAnyClassIn(DoubleObjectFactory.class, DoubleAsStringObjectFactory.class,
|
||||
LongAsStringObjectFactory.class, LongObjectFactory.class);
|
||||
|
||||
T t1 = getT();
|
||||
T t2 = getT();
|
||||
T t3 = getT();
|
||||
|
||||
zSet.add(t1, 1);
|
||||
zSet.add(t2, 2);
|
||||
zSet.add(t3, 3);
|
||||
Set<T> tuples = zSet.reverseRangeByLex(RedisZSetCommands.Range.range().gte(t1),
|
||||
RedisZSetCommands.Limit.limit().count(2).offset(1));
|
||||
|
||||
assertThat(tuples).hasSize(2).containsSequence(t2, t1);
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-729
|
||||
public void testReverseRangeByScore() {
|
||||
|
||||
T t1 = getT();
|
||||
|
||||
Reference in New Issue
Block a user