This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git
The following commit(s) were added to refs/heads/master by this push:
new 44af0ea09 Simplify test setups
44af0ea09 is described below
commit 44af0ea099fb8ad5d9485809a38af07f5ffc8389
Author: Gary Gregory <[email protected]>
AuthorDate: Wed Feb 28 13:36:34 2024 -0500
Simplify test setups
---
.../apache/commons/compress/compressors/GZipTest.java | 17 ++---------------
1 file changed, 2 insertions(+), 15 deletions(-)
diff --git
a/src/test/java/org/apache/commons/compress/compressors/GZipTest.java
b/src/test/java/org/apache/commons/compress/compressors/GZipTest.java
index 62536ab60..76a189332 100644
--- a/src/test/java/org/apache/commons/compress/compressors/GZipTest.java
+++ b/src/test/java/org/apache/commons/compress/compressors/GZipTest.java
@@ -190,13 +190,8 @@ public final class GZipTest extends AbstractTest {
@Test
public void testInteroperabilityWithGzipCompressorInputStream() throws
Exception {
- final byte[] content;
- try (InputStream fis = newInputStream("test3.xml")) {
- content = IOUtils.toByteArray(fis);
- }
-
+ final byte[] content = readAllBytes("test3.xml");
final ByteArrayOutputStream bout = new ByteArrayOutputStream();
-
final GzipParameters parameters = new GzipParameters();
parameters.setCompressionLevel(Deflater.BEST_COMPRESSION);
parameters.setOperatingSystem(3);
@@ -210,7 +205,6 @@ public final class GZipTest extends AbstractTest {
out.write(content);
out.flush();
}
-
try (GzipCompressorInputStream in = new GzipCompressorInputStream(new
ByteArrayInputStream(bout.toByteArray()))) {
final byte[] content2 = IOUtils.toByteArray(in);
assertArrayEquals(content, content2, "uncompressed content");
@@ -219,13 +213,8 @@ public final class GZipTest extends AbstractTest {
@Test
public void testInteroperabilityWithGZIPInputStream() throws Exception {
- final byte[] content;
- try (InputStream fis = newInputStream("test3.xml")) {
- content = IOUtils.toByteArray(fis);
- }
-
+ final byte[] content = readAllBytes("test3.xml");
final ByteArrayOutputStream bout = new ByteArrayOutputStream();
-
final GzipParameters parameters = new GzipParameters();
parameters.setCompressionLevel(Deflater.BEST_COMPRESSION);
parameters.setOperatingSystem(3);
@@ -239,10 +228,8 @@ public final class GZipTest extends AbstractTest {
out.write(content);
out.flush();
}
-
final GZIPInputStream in = new GZIPInputStream(new
ByteArrayInputStream(bout.toByteArray()));
final byte[] content2 = IOUtils.toByteArray(in);
-
assertArrayEquals(content, content2, "uncompressed content");
}