diff --git a/src/main/java/org/springframework/data/redis/stream/StreamReceiver.java b/src/main/java/org/springframework/data/redis/stream/StreamReceiver.java index 4a0154978..b85d08282 100644 --- a/src/main/java/org/springframework/data/redis/stream/StreamReceiver.java +++ b/src/main/java/org/springframework/data/redis/stream/StreamReceiver.java @@ -328,7 +328,7 @@ public interface StreamReceiver> { * @param pair must not be {@literal null}. * @return {@code this} {@link StreamReceiverOptionsBuilder}. */ - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) public StreamReceiverOptionsBuilder> serializer(SerializationPair pair) { Assert.notNull(pair, "SerializationPair must not be null"); @@ -345,7 +345,7 @@ public interface StreamReceiver> { * @param serializationContext must not be {@literal null}. * @return {@code this} {@link StreamReceiverOptionsBuilder}. */ - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) public StreamReceiverOptionsBuilder> serializer( RedisSerializationContext serializationContext) { @@ -364,7 +364,7 @@ public interface StreamReceiver> { * @param pair must not be {@literal null}. * @return {@code this} {@link StreamReceiverOptionsBuilder}. */ - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) public > StreamReceiverOptionsBuilder keySerializer( SerializationPair pair) { @@ -380,7 +380,7 @@ public interface StreamReceiver> { * @param pair must not be {@literal null}. * @return {@code this} {@link StreamReceiverOptionsBuilder}. */ - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) public StreamReceiverOptionsBuilder> hashKeySerializer( SerializationPair pair) { @@ -396,7 +396,7 @@ public interface StreamReceiver> { * @param pair must not be {@literal null}. * @return {@code this} {@link StreamReceiverOptionsBuilder}. */ - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) public StreamReceiverOptionsBuilder> hashValueSerializer( SerializationPair pair) { @@ -412,7 +412,7 @@ public interface StreamReceiver> { * @param targetType must not be {@literal null}. * @return {@code this} {@link StreamReceiverOptionsBuilder}. */ - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) public StreamReceiverOptionsBuilder> targetType(Class targetType) { Assert.notNull(targetType, "Target type must not be null"); @@ -435,7 +435,7 @@ public interface StreamReceiver> { * @param hashMapper must not be {@literal null}. * @return {@code this} {@link StreamReceiverOptionsBuilder}. */ - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) public StreamReceiverOptionsBuilder> objectMapper(HashMapper hashMapper) { Assert.notNull(hashMapper, "HashMapper must not be null"); diff --git a/src/test/java/org/springframework/data/redis/stream/StreamReceiverIntegrationTests.java b/src/test/java/org/springframework/data/redis/stream/StreamReceiverIntegrationTests.java index 95f599724..7146a78d9 100644 --- a/src/test/java/org/springframework/data/redis/stream/StreamReceiverIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/stream/StreamReceiverIntegrationTests.java @@ -18,6 +18,7 @@ package org.springframework.data.redis.stream; import static org.assertj.core.api.Assertions.*; import static org.junit.Assume.*; import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; import lombok.AllArgsConstructor; import lombok.Data; @@ -32,7 +33,7 @@ import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; -import org.mockito.Mockito; + import org.springframework.data.redis.ConnectionFactoryTracker; import org.springframework.data.redis.RedisSystemException; import org.springframework.data.redis.RedisVersionUtils; @@ -175,8 +176,8 @@ public class StreamReceiverIntegrationTests { @Test // DATAREDIS-1172 public void shouldReceiveCustomHashValueRecords() { - SerializationPair serializationPair = Mockito.mock(SerializationPair.class); - Mockito.when(serializationPair.read(any(ByteBuffer.class))).thenReturn(345920); + SerializationPair serializationPair = mock(SerializationPair.class); + when(serializationPair.read(any(ByteBuffer.class))).thenReturn(345920); StreamReceiverOptions> receiverOptions = StreamReceiverOptions.builder() .hashValueSerializer(serializationPair).build(); @@ -227,7 +228,6 @@ public class StreamReceiverIntegrationTests { }).consumeNextWith(it -> { assertThat(it.getStream()).isEqualTo("my-stream"); - // assertThat(it.getValue()).containsEntry("key", "value3"); }) // .thenCancel() // .verify(Duration.ofSeconds(5));