diff --git a/src/main/java/org/springframework/data/redis/connection/RedisListCommands.java b/src/main/java/org/springframework/data/redis/connection/RedisListCommands.java
index f55ef5571..e8c4e85f2 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisListCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisListCommands.java
@@ -49,7 +49,7 @@ public interface RedisListCommands {
/**
* Returns the index of matching elements inside the list stored at given {@literal key}.
- * Requires Redis 6.0.6.
+ * Requires Redis 6.0.6 or newer.
*
* @param key must not be {@literal null}.
* @param element must not be {@literal null}.
@@ -64,7 +64,7 @@ public interface RedisListCommands {
/**
* Returns the index of matching elements inside the list stored at given {@literal key}.
- * Requires Redis 6.0.6.
+ * Requires Redis 6.0.6 or newer.
*
* @param key must not be {@literal null}.
* @param element must not be {@literal null}.
diff --git a/src/main/java/org/springframework/data/redis/connection/StringRedisConnection.java b/src/main/java/org/springframework/data/redis/connection/StringRedisConnection.java
index 8f6be25cd..537804873 100644
--- a/src/main/java/org/springframework/data/redis/connection/StringRedisConnection.java
+++ b/src/main/java/org/springframework/data/redis/connection/StringRedisConnection.java
@@ -688,7 +688,7 @@ public interface StringRedisConnection extends RedisConnection {
/**
* Returns the index of matching elements inside the list stored at given {@literal key}.
- * Requires Redis 6.0.6.
+ * Requires Redis 6.0.6 or newer.
*
* @param key must not be {@literal null}.
* @param element must not be {@literal null}.
@@ -703,7 +703,7 @@ public interface StringRedisConnection extends RedisConnection {
/**
* Returns the index of matching elements inside the list stored at given {@literal key}.
- * Requires Redis 6.0.6.
+ * Requires Redis 6.0.6 or newer.
*
* @param key must not be {@literal null}.
* @param element must not be {@literal null}.
@@ -2059,7 +2059,7 @@ public interface StringRedisConnection extends RedisConnection {
/**
* Append the given {@link StringRecord} to the stream stored at {@link StringRecord#getStream()}.
- *
+ *
* @param record must not be {@literal null}.
* @param options must not be {@literal null}, use {@link XAddOptions#none()} instead.
* @return the record Id. {@literal null} when used in pipeline / transaction.
diff --git a/src/main/java/org/springframework/data/redis/core/BoundListOperations.java b/src/main/java/org/springframework/data/redis/core/BoundListOperations.java
index 7482da475..94f4a9b64 100644
--- a/src/main/java/org/springframework/data/redis/core/BoundListOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/BoundListOperations.java
@@ -171,7 +171,7 @@ public interface BoundListOperations extends BoundKeyOperations {
/**
* Returns the index of the first occurrence of the specified value in the list at at {@code key}.
- * Requires Redis 6.0.6
+ * Requires Redis 6.0.6 or newer.
*
* @param value must not be {@literal null}.
* @return {@literal null} when used in pipeline / transaction or when not contained in list.
@@ -182,7 +182,7 @@ public interface BoundListOperations extends BoundKeyOperations {
/**
* Returns the index of the last occurrence of the specified value in the list at at {@code key}.
- * Requires Redis 6.0.6
+ * Requires Redis 6.0.6 or newer.
*
* @param value must not be {@literal null}.
* @return {@literal null} when used in pipeline / transaction or when not contained in list.
diff --git a/src/main/java/org/springframework/data/redis/core/ListOperations.java b/src/main/java/org/springframework/data/redis/core/ListOperations.java
index 851b98930..9c1bce09f 100644
--- a/src/main/java/org/springframework/data/redis/core/ListOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/ListOperations.java
@@ -215,7 +215,7 @@ public interface ListOperations {
/**
* Returns the index of the first occurrence of the specified value in the list at at {@code key}.
- * Requires Redis 6.0.6
+ * Requires Redis 6.0.6 or newer.
*
* @param key must not be {@literal null}.
* @param value must not be {@literal null}.
@@ -227,7 +227,7 @@ public interface ListOperations {
/**
* Returns the index of the last occurrence of the specified value in the list at at {@code key}.
- * Requires Redis 6.0.6
+ * Requires Redis 6.0.6 or newer.
*
* @param key must not be {@literal null}.
* @param value must not be {@literal null}.
diff --git a/src/main/java/org/springframework/data/redis/core/ReactiveListOperations.java b/src/main/java/org/springframework/data/redis/core/ReactiveListOperations.java
index 61204eee3..bbbd1d052 100644
--- a/src/main/java/org/springframework/data/redis/core/ReactiveListOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/ReactiveListOperations.java
@@ -198,7 +198,7 @@ public interface ReactiveListOperations {
/**
* Returns the index of the first occurrence of the specified value in the list at at {@code key}.
- * Requires Redis 6.0.6
+ * Requires Redis 6.0.6 or newer.
*
* @param key must not be {@literal null}.
* @param value must not be {@literal null}.
@@ -210,7 +210,7 @@ public interface ReactiveListOperations {
/**
* Returns the index of the last occurrence of the specified value in the list at at {@code key}.
- * Requires Redis 6.0.6
+ * Requires Redis 6.0.6 or newer.
*
* @param key must not be {@literal null}.
* @param value must not be {@literal null}.
diff --git a/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisListTests.java b/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisListTests.java
index f02c1f1cc..c74769866 100644
--- a/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisListTests.java
+++ b/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisListTests.java
@@ -16,6 +16,7 @@
package org.springframework.data.redis.support.collections;
import static org.assertj.core.api.Assertions.*;
+import static org.assertj.core.api.Assumptions.*;
import java.util.ArrayList;
import java.util.Arrays;
@@ -24,10 +25,10 @@ import java.util.List;
import java.util.NoSuchElementException;
import java.util.concurrent.TimeUnit;
-import org.assertj.core.api.Assumptions;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
+
import org.springframework.data.redis.ObjectFactory;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
@@ -168,7 +169,7 @@ public abstract class AbstractRedisListTests extends AbstractRedisCollectionT
@IfProfileValue(name = "redisVersion", value = "6.0.6+")
public void testIndexOfObject() {
- Assumptions.assumeThat(template.getConnectionFactory()).isInstanceOf(LettuceConnectionFactory.class);
+ assumeThat(template.getConnectionFactory()).isInstanceOf(LettuceConnectionFactory.class);
T t1 = getT();
T t2 = getT();
@@ -249,10 +250,10 @@ public abstract class AbstractRedisListTests extends AbstractRedisCollectionT
T t1 = getT();
T t2 = getT();
- assertThat(list.range(0, -1).isEmpty()).isTrue();
+ assertThat(list.range(0, -1)).isEmpty();
list.add(t1);
list.add(t2);
- assertThat(list.range(0, -1).size()).isEqualTo(2);
+ assertThat(list.range(0, -1)).hasSize(2);
assertThat(list.range(0, 0).get(0)).isEqualTo(t1);
assertThat(list.range(1, 1).get(0)).isEqualTo(t2);
}
@@ -285,12 +286,12 @@ public abstract class AbstractRedisListTests extends AbstractRedisCollectionT
T t1 = getT();
T t2 = getT();
- assertThat(list.trim(0, 0).isEmpty()).isTrue();
+ assertThat(list.trim(0, 0)).isEmpty();
list.add(t1);
list.add(t2);
- assertThat(list.size()).isEqualTo(2);
- assertThat(list.trim(0, 0).size()).isEqualTo(1);
- assertThat(list.size()).isEqualTo(1);
+ assertThat(list).hasSize(2);
+ assertThat(list.trim(0, 0)).hasSize(1);
+ assertThat(list).hasSize(1);
assertThat(list.get(0)).isEqualTo(t1);
}
@@ -300,12 +301,12 @@ public abstract class AbstractRedisListTests extends AbstractRedisCollectionT
RedisList cappedList = new DefaultRedisList(template.boundListOps(collection.getKey() + ":capped"), 1);
T first = getT();
cappedList.offer(first);
- assertThat(cappedList.size()).isEqualTo(1);
+ assertThat(cappedList).hasSize(1);
cappedList.add(getT());
- assertThat(cappedList.size()).isEqualTo(1);
+ assertThat(cappedList).hasSize(1);
T last = getT();
cappedList.add(last);
- assertThat(cappedList.size()).isEqualTo(1);
+ assertThat(cappedList).hasSize(1);
assertThat(cappedList.get(0)).isEqualTo(first);
}
@@ -361,10 +362,8 @@ public abstract class AbstractRedisListTests extends AbstractRedisCollectionT
List c = new ArrayList<>();
list.drainTo(c, 2);
- assertThat(list.size()).isEqualTo(1);
- assertThat(list).contains(t3);
- assertThat(c.size()).isEqualTo(2);
- assertThat(c).contains(t1, t2);
+ assertThat(list).hasSize(1).contains(t3);
+ assertThat(c).hasSize(2).contains(t1, t2);
}
@SuppressWarnings("unchecked")
@@ -381,9 +380,8 @@ public abstract class AbstractRedisListTests extends AbstractRedisCollectionT
List c = new ArrayList<>();
list.drainTo(c);
- assertThat(list.isEmpty()).isTrue();
- assertThat(c.size()).isEqualTo(3);
- assertThat(c).contains(t1, t2, t3);
+ assertThat(list).isEmpty();
+ assertThat(c).hasSize(3).contains(t1, t2, t3);
}
@Test
@@ -426,7 +424,7 @@ public abstract class AbstractRedisListTests extends AbstractRedisCollectionT
list.add(t2);
assertThat(list.peekLast()).isEqualTo(t2);
- assertThat(list.size()).isEqualTo(2);
+ assertThat(list).hasSize(2);
}
@Test
@@ -444,8 +442,7 @@ public abstract class AbstractRedisListTests extends AbstractRedisCollectionT
T last = list.pollLast();
assertThat(last).isEqualTo(t2);
- assertThat(list.size()).isEqualTo(1);
- assertThat(list).contains(t1);
+ assertThat(list).hasSize(1).contains(t1);
}
@Test
@@ -459,8 +456,7 @@ public abstract class AbstractRedisListTests extends AbstractRedisCollectionT
T last = list.pollLast(1, TimeUnit.MILLISECONDS);
assertThat(last).isEqualTo(t2);
- assertThat(list.size()).isEqualTo(1);
- assertThat(list).contains(t1);
+ assertThat(list).hasSize(1).contains(t1);
}
@Test
@@ -500,6 +496,7 @@ public abstract class AbstractRedisListTests extends AbstractRedisCollectionT
@Test
public void testRmoveLastOccurrence() {
+
T t1 = getT();
T t2 = getT();
@@ -509,11 +506,7 @@ public abstract class AbstractRedisListTests extends AbstractRedisCollectionT
list.add(t2);
list.removeLastOccurrence(t2);
- assertThat(list.size()).isEqualTo(3);
- Iterator iterator = list.iterator();
- assertThat(iterator.next()).isEqualTo(t1);
- assertThat(iterator.next()).isEqualTo(t2);
- assertThat(iterator.next()).isEqualTo(t1);
+ assertThat(list).hasSize(3).containsExactly(t1, t2, t1);
}
@Test
@@ -535,7 +528,7 @@ public abstract class AbstractRedisListTests extends AbstractRedisCollectionT
@IfProfileValue(name = "redisVersion", value = "6.0.6+")
public void lastIndexOf() {
- Assumptions.assumeThat(template.getConnectionFactory()).isInstanceOf(LettuceConnectionFactory.class);
+ assumeThat(template.getConnectionFactory()).isInstanceOf(LettuceConnectionFactory.class);
T t1 = getT();
T t2 = getT();
diff --git a/src/test/java/org/springframework/data/redis/support/collections/RedisListTests.java b/src/test/java/org/springframework/data/redis/support/collections/RedisListTests.java
index 69433c905..eeb3497bb 100644
--- a/src/test/java/org/springframework/data/redis/support/collections/RedisListTests.java
+++ b/src/test/java/org/springframework/data/redis/support/collections/RedisListTests.java
@@ -31,16 +31,16 @@ public class RedisListTests extends AbstractRedisListTests