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 e5a4a4b Continue porting from JUnit 4 to JUnit 5. e5a4a4b is described below commit e5a4a4b9f3717588a318e05a7be74e445a052ff1 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Sun Dec 26 19:40:14 2021 -0500 Continue porting from JUnit 4 to JUnit 5. --- .../archivers/examples/ParameterizedArchiverTest.java | 16 +++++----------- .../compress/archivers/examples/SevenZArchiverTest.java | 10 +++++----- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/test/java/org/apache/commons/compress/archivers/examples/ParameterizedArchiverTest.java b/src/test/java/org/apache/commons/compress/archivers/examples/ParameterizedArchiverTest.java index a37d646..82ad8a0 100644 --- a/src/test/java/org/apache/commons/compress/archivers/examples/ParameterizedArchiverTest.java +++ b/src/test/java/org/apache/commons/compress/archivers/examples/ParameterizedArchiverTest.java @@ -18,6 +18,9 @@ */ package org.apache.commons.compress.archivers.examples; +import static java.nio.charset.StandardCharsets.UTF_8; +import static org.junit.jupiter.api.Assertions.assertNotNull; + import java.io.BufferedInputStream; import java.io.File; import java.io.IOException; @@ -27,8 +30,6 @@ import java.nio.channels.FileChannel; import java.nio.channels.SeekableByteChannel; import java.nio.file.Files; import java.nio.file.StandardOpenOption; -import java.util.Arrays; -import java.util.Collection; import java.util.stream.Stream; import org.apache.commons.compress.AbstractTestCase; @@ -39,16 +40,9 @@ import org.apache.commons.compress.archivers.ArchiveOutputStream; import org.apache.commons.compress.archivers.ArchiveStreamFactory; import org.apache.commons.compress.utils.IOUtils; import org.junit.Assert; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized.Parameters; -import org.junit.runners.Parameterized; - -import static java.nio.charset.StandardCharsets.*; public class ParameterizedArchiverTest extends AbstractTestCase { @@ -144,14 +138,14 @@ public class ParameterizedArchiverTest extends AbstractTestCase { } private void assertDir(final String expectedName, final ArchiveEntry entry) { - Assert.assertNotNull(expectedName + " does not exists", entry); + assertNotNull(entry, () -> expectedName + " does not exists"); Assert.assertEquals(expectedName + "/", entry.getName()); Assert.assertTrue(expectedName + " is not a directory", entry.isDirectory()); } private void assertHelloWorld(final String expectedName, final String suffix, final ArchiveEntry entry, final InputStream is) throws IOException { - Assert.assertNotNull(expectedName + " does not exists", entry); + assertNotNull(entry, () -> expectedName + " does not exists"); Assert.assertEquals(expectedName, entry.getName()); Assert.assertFalse(expectedName + " is a directory", entry.isDirectory()); final byte[] expected = ("Hello, world " + suffix).getBytes(UTF_8); diff --git a/src/test/java/org/apache/commons/compress/archivers/examples/SevenZArchiverTest.java b/src/test/java/org/apache/commons/compress/archivers/examples/SevenZArchiverTest.java index 579ef93..6655159 100644 --- a/src/test/java/org/apache/commons/compress/archivers/examples/SevenZArchiverTest.java +++ b/src/test/java/org/apache/commons/compress/archivers/examples/SevenZArchiverTest.java @@ -18,6 +18,9 @@ */ package org.apache.commons.compress.archivers.examples; +import static java.nio.charset.StandardCharsets.UTF_8; +import static org.junit.jupiter.api.Assertions.assertNotNull; + import java.io.File; import java.io.IOException; import java.io.OutputStream; @@ -29,14 +32,11 @@ import java.nio.file.StandardOpenOption; import org.apache.commons.compress.AbstractTestCase; import org.apache.commons.compress.archivers.ArchiveEntry; import org.apache.commons.compress.archivers.ArchiveException; -import org.apache.commons.compress.archivers.StreamingNotSupportedException; import org.apache.commons.compress.archivers.sevenz.SevenZFile; import org.junit.Assert; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static java.nio.charset.StandardCharsets.*; - public class SevenZArchiverTest extends AbstractTestCase { private File target; @@ -106,14 +106,14 @@ public class SevenZArchiverTest extends AbstractTestCase { } private void assertDir(final String expectedName, final ArchiveEntry entry) { - Assert.assertNotNull(expectedName + " does not exists", entry); + assertNotNull(entry, () -> expectedName + " does not exists"); Assert.assertEquals(expectedName + "/", entry.getName()); Assert.assertTrue(expectedName + " is not a directory", entry.isDirectory()); } private void assertHelloWorld(final String expectedName, final String suffix, final ArchiveEntry entry, final SevenZFile z) throws IOException { - Assert.assertNotNull(expectedName + " does not exists", entry); + assertNotNull(entry, () -> expectedName + " does not exists"); Assert.assertEquals(expectedName, entry.getName()); Assert.assertFalse(expectedName + " is a directory", entry.isDirectory()); final byte[] expected = ("Hello, world " + suffix).getBytes(UTF_8);