From a7aed8f8cca347e62e99d822f9c39690d23aa6cc Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Sat, 14 Nov 2020 18:19:43 +0100 Subject: [PATCH] Polishing #1519 Adapt code to changed GZip output on Java 16. --- .../core/codec/CompressionCodecUnitTests.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/test/java/io/lettuce/core/codec/CompressionCodecUnitTests.java b/src/test/java/io/lettuce/core/codec/CompressionCodecUnitTests.java index 49a154c793..dc919cc7e7 100644 --- a/src/test/java/io/lettuce/core/codec/CompressionCodecUnitTests.java +++ b/src/test/java/io/lettuce/core/codec/CompressionCodecUnitTests.java @@ -15,8 +15,7 @@ */ package io.lettuce.core.codec; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.assertj.core.api.Assertions.*; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; @@ -24,6 +23,8 @@ import org.junit.jupiter.api.Test; /** + * Unit tests for {@link CompressionCodec}. + * * @author Mark Paluch */ class CompressionCodecUnitTests { @@ -50,10 +51,9 @@ void gzipValueTest() { RedisCodec sut = CompressionCodec.valueCompressor(StringCodec.UTF8, CompressionCodec.CompressionType.GZIP); ByteBuffer byteBuffer = sut.encodeValue(key); - assertThat(toBytes(byteBuffer.duplicate())).isEqualTo(keyGzipBytes); - String s = sut.decodeValue(ByteBuffer.wrap(keyGzipBytes)); - assertThat(s).isEqualTo(key); + assertThat(sut.decodeValue(byteBuffer)).isEqualTo(key); + assertThat(sut.decodeValue(ByteBuffer.wrap(keyGzipBytes))).isEqualTo(key); } @Test @@ -61,10 +61,9 @@ void deflateValueTest() { RedisCodec sut = CompressionCodec.valueCompressor(StringCodec.UTF8, CompressionCodec.CompressionType.DEFLATE); ByteBuffer byteBuffer = sut.encodeValue(key); - assertThat(toBytes(byteBuffer.duplicate())).isEqualTo(keyDeflateBytes); - String s = sut.decodeValue(ByteBuffer.wrap(keyDeflateBytes)); - assertThat(s).isEqualTo(key); + assertThat(sut.decodeValue(byteBuffer)).isEqualTo(key); + assertThat(sut.decodeValue(ByteBuffer.wrap(keyDeflateBytes))).isEqualTo(key); } @Test