diff --git a/redisson/src/test/java/org/redisson/RedissonLexSortedSetReactiveTest.java b/redisson/src/test/java/org/redisson/RedissonLexSortedSetReactiveTest.java index 20255ebe1..250d4f36d 100644 --- a/redisson/src/test/java/org/redisson/RedissonLexSortedSetReactiveTest.java +++ b/redisson/src/test/java/org/redisson/RedissonLexSortedSetReactiveTest.java @@ -1,12 +1,20 @@ package org.redisson; -import static org.assertj.core.api.Assertions.*; +import static org.assertj.core.api.Assertions.assertThat; + import org.junit.Assert; import org.junit.Test; import org.redisson.api.RLexSortedSetReactive; +import reactor.rx.Streams; + public class RedissonLexSortedSetReactiveTest extends BaseReactiveTest { + public static <V> Iterable<V> sync(RLexSortedSetReactive list) { + return (Iterable<V>) Streams.create(list.iterator()).toList().poll(); + } + + @Test public void testAddAllReactive() { RLexSortedSetReactive list = redisson.getLexSortedSet("set"); @@ -33,11 +41,11 @@ public class RedissonLexSortedSetReactiveTest extends BaseReactiveTest { Assert.assertTrue(sync(set.add("f")) == 1); Assert.assertTrue(sync(set.add("g")) == 1); - Assert.assertEquals(0, sync(set.removeRangeTailByLex("z", false)).intValue()); + Assert.assertEquals(0, sync(set.removeRangeTail("z", false)).intValue()); - Assert.assertEquals(4, sync(set.removeRangeTailByLex("c", false)).intValue()); + Assert.assertEquals(4, sync(set.removeRangeTail("c", false)).intValue()); assertThat(sync(set)).containsExactly("a", "b", "c"); - Assert.assertEquals(1, sync(set.removeRangeTailByLex("c", true)).intValue()); + Assert.assertEquals(1, sync(set.removeRangeTail("c", true)).intValue()); assertThat(sync(set)).containsExactly("a", "b"); } @@ -53,9 +61,9 @@ public class RedissonLexSortedSetReactiveTest extends BaseReactiveTest { sync(set.add("f")); sync(set.add("g")); - Assert.assertEquals(2, sync(set.removeRangeHeadByLex("c", false)).intValue()); + Assert.assertEquals(2, sync(set.removeRangeHead("c", false)).intValue()); assertThat(sync(set)).containsExactly("c", "d", "e", "f", "g"); - Assert.assertEquals(1, (int)sync(set.removeRangeHeadByLex("c", true))); + Assert.assertEquals(1, (int)sync(set.removeRangeHead("c", true))); assertThat(sync(set)).containsExactly("d", "e", "f", "g"); } @@ -70,7 +78,7 @@ public class RedissonLexSortedSetReactiveTest extends BaseReactiveTest { sync(set.add("f")); sync(set.add("g")); - Assert.assertEquals(5, sync(set.removeRangeByLex("aaa", true, "g", false)).intValue()); + Assert.assertEquals(5, sync(set.removeRange("aaa", true, "g", false)).intValue()); assertThat(sync(set)).containsExactly("a", "g"); } @@ -87,8 +95,8 @@ public class RedissonLexSortedSetReactiveTest extends BaseReactiveTest { Assert.assertTrue(sync(set.add("f")) == 1); Assert.assertTrue(sync(set.add("g")) == 1); - assertThat(sync(set.lexRangeTail("c", false))).containsExactly("d", "e", "f", "g"); - assertThat(sync(set.lexRangeTail("c", true))).containsExactly("c", "d", "e", "f", "g"); + assertThat(sync(set.rangeTail("c", false))).containsExactly("d", "e", "f", "g"); + assertThat(sync(set.rangeTail("c", true))).containsExactly("c", "d", "e", "f", "g"); } @@ -103,8 +111,8 @@ public class RedissonLexSortedSetReactiveTest extends BaseReactiveTest { sync(set.add("f")); sync(set.add("g")); - assertThat(sync(set.lexRangeHead("c", false))).containsExactly("a", "b"); - assertThat(sync(set.lexRangeHead("c", true))).containsExactly("a", "b", "c"); + assertThat(sync(set.rangeHead("c", false))).containsExactly("a", "b"); + assertThat(sync(set.rangeHead("c", true))).containsExactly("a", "b", "c"); } @@ -119,7 +127,7 @@ public class RedissonLexSortedSetReactiveTest extends BaseReactiveTest { sync(set.add("f")); sync(set.add("g")); - assertThat(sync(set.lexRange("aaa", true, "g", false))).contains("b", "c", "d", "e", "f"); + assertThat(sync(set.range("aaa", true, "g", false))).contains("b", "c", "d", "e", "f"); } @Test @@ -133,8 +141,8 @@ public class RedissonLexSortedSetReactiveTest extends BaseReactiveTest { sync(set.add("f")); sync(set.add("g")); - Assert.assertEquals(5, (int)sync(set.lexCount("b", true, "f", true))); - Assert.assertEquals(3, (int)sync(set.lexCount("b", false, "f", false))); + Assert.assertEquals(5, (int)sync(set.count("b", true, "f", true))); + Assert.assertEquals(3, (int)sync(set.count("b", false, "f", false))); } }