aboutsummaryrefslogtreecommitdiffstats
path: root/airlift-zstd/src/test/java/ai/vespa/airlift/zstd/TestZstdInputStream.java
diff options
context:
space:
mode:
Diffstat (limited to 'airlift-zstd/src/test/java/ai/vespa/airlift/zstd/TestZstdInputStream.java')
-rw-r--r--airlift-zstd/src/test/java/ai/vespa/airlift/zstd/TestZstdInputStream.java19
1 files changed, 9 insertions, 10 deletions
diff --git a/airlift-zstd/src/test/java/ai/vespa/airlift/zstd/TestZstdInputStream.java b/airlift-zstd/src/test/java/ai/vespa/airlift/zstd/TestZstdInputStream.java
index fdf521b7d92..f233ff76825 100644
--- a/airlift-zstd/src/test/java/ai/vespa/airlift/zstd/TestZstdInputStream.java
+++ b/airlift-zstd/src/test/java/ai/vespa/airlift/zstd/TestZstdInputStream.java
@@ -13,7 +13,6 @@
*/
package ai.vespa.airlift.zstd;
-import com.google.common.io.Resources;
import ai.vespa.airlift.compress.AbstractTestCompression;
import ai.vespa.airlift.compress.Compressor;
import ai.vespa.airlift.compress.Decompressor;
@@ -153,8 +152,8 @@ public class TestZstdInputStream
{
int padding = 1021;
- byte[] compressed = Resources.toByteArray(getClass().getClassLoader().getResource("data/zstd/with-checksum.zst"));
- byte[] uncompressed = Resources.toByteArray(getClass().getClassLoader().getResource("data/zstd/with-checksum"));
+ byte[] compressed = getResourceBytes("data/zstd/with-checksum.zst");
+ byte[] uncompressed = getResourceBytes("data/zstd/with-checksum");
byte[] output = new byte[uncompressed.length + padding * 2]; // pre + post padding
int decompressedSize = getDecompressor().decompress(compressed, 0, compressed.length, output, padding, output.length - padding);
@@ -166,8 +165,8 @@ public class TestZstdInputStream
public void testConcatenatedFrames()
throws IOException
{
- byte[] compressed = Resources.toByteArray(getClass().getClassLoader().getResource("data/zstd/multiple-frames.zst"));
- byte[] uncompressed = Resources.toByteArray(getClass().getClassLoader().getResource("data/zstd/multiple-frames"));
+ byte[] compressed = getResourceBytes("data/zstd/multiple-frames.zst");
+ byte[] uncompressed = getResourceBytes("data/zstd/multiple-frames");
byte[] output = new byte[uncompressed.length];
getDecompressor().decompress(compressed, 0, compressed.length, output, 0, output.length);
@@ -179,7 +178,7 @@ public class TestZstdInputStream
public void testInvalidSequenceOffset()
throws IOException
{
- byte[] compressed = Resources.toByteArray(getClass().getClassLoader().getResource("data/zstd/offset-before-start.zst"));
+ byte[] compressed = getResourceBytes("data/zstd/offset-before-start.zst");
byte[] output = new byte[compressed.length * 10];
assertThatThrownBy(() -> getDecompressor().decompress(compressed, 0, compressed.length, output, 0, output.length))
@@ -195,7 +194,7 @@ public class TestZstdInputStream
Compressor compressor = getCompressor();
- byte[] original = Resources.toByteArray(getClass().getClassLoader().getResource("data/zstd/large-rle"));
+ byte[] original = getResourceBytes("data/zstd/large-rle");
int maxCompressLength = compressor.maxCompressedLength(original.length);
byte[] compressed = new byte[maxCompressLength];
@@ -215,7 +214,7 @@ public class TestZstdInputStream
Compressor compressor = getCompressor();
- byte[] original = Resources.toByteArray(getClass().getClassLoader().getResource("data/zstd/incompressible"));
+ byte[] original = getResourceBytes("data/zstd/incompressible");
int maxCompressLength = compressor.maxCompressedLength(original.length);
byte[] compressed = new byte[maxCompressLength];
@@ -232,8 +231,8 @@ public class TestZstdInputStream
throws IOException
{
Compressor compressor = getCompressor();
- byte[] compressed = Resources.toByteArray(getClass().getClassLoader().getResource("data/zstd/bad-second-frame.zst"));
- byte[] uncompressed = Resources.toByteArray(getClass().getClassLoader().getResource("data/zstd/multiple-frames"));
+ byte[] compressed = getResourceBytes("data/zstd/bad-second-frame.zst");
+ byte[] uncompressed = getResourceBytes("data/zstd/multiple-frames");
byte[] output = new byte[uncompressed.length];
assertThatThrownBy(() -> getDecompressor().decompress(compressed, 0, compressed.length, output, 0, output.length))
.isInstanceOf(MalformedInputException.class)