From 17f117ff3947aef7721464d403cf5b46065d16e9 Mon Sep 17 00:00:00 2001 From: Slawomir Jaranowski Date: Thu, 13 Jul 2023 17:57:14 +0200 Subject: [PATCH] Remove public modifier from JUnit 5 tests https://junit.org/junit5/docs/current/user-guide/#writing-tests-classes-and-methods --- .gitignore | 4 +- .../plexus/archiver/AbstractArchiverTest.java | 18 ++++---- .../archiver/AbstractUnArchiverTest.java | 27 ++++++----- .../DotDirectiveArchiveFinalizerTest.java | 6 +-- .../plexus/archiver/DuplicateFilesTest.java | 8 ++-- .../plexus/archiver/EmptyDirectoryTest.java | 8 ++-- .../codehaus/plexus/archiver/SymlinkTest.java | 14 +++--- .../archiver/bzip2/BZip2ArchiverTest.java | 10 ++-- .../archiver/gzip/GZipArchiverTest.java | 10 ++-- .../archiver/jar/BaseJarArchiverTest.java | 2 +- .../jar/DirectoryArchiverUnpackJarTest.java | 4 +- .../plexus/archiver/jar/IndexTest.java | 6 +-- .../plexus/archiver/jar/JarArchiverTest.java | 10 ++-- .../jar/JarToolModularJarArchiverTest.java | 22 ++++----- .../archiver/jar/JdkManifestFactoryTest.java | 12 ++--- .../plexus/archiver/jar/ManifestTest.java | 44 +++++++++--------- .../plexus/archiver/rar/RarArchiverTest.java | 8 ++-- .../plexus/archiver/sar/SarArchiverTest.java | 4 +- .../archiver/snappy/SnappyArchiverTest.java | 10 ++-- .../plexus/archiver/tar/TarArchiverTest.java | 26 +++++------ .../archiver/tar/TarBZip2UnArchiverTest.java | 6 +-- .../archiver/tar/TarFileAttributesTest.java | 10 ++-- .../plexus/archiver/tar/TarFileTest.java | 8 ++-- .../archiver/tar/TarGZipUnArchiverTest.java | 6 +-- .../plexus/archiver/tar/TarRoundTripTest.java | 4 +- .../archiver/tar/TarSnappyUnArchiverTest.java | 6 +-- .../archiver/tar/TarUnArchiverTest.java | 6 +-- .../archiver/tar/TarXzUnArchiverTest.java | 6 +-- .../archiver/tar/TarZstdUnArchiverTest.java | 6 +-- .../archiver/util/ArchiveEntryUtilsTest.java | 6 +-- .../archiver/util/DefaultFileSetTest.java | 4 +- .../util/FilePermissionUtilsTest.java | 10 ++-- .../plexus/archiver/war/WarArchiverTest.java | 6 +-- .../plexus/archiver/xz/XzArchiverTest.java | 10 ++-- .../zip/ConcurrentJarCreatorTest.java | 8 ++-- ...ArchiverZipFileResourceCollectionTest.java | 6 +-- ...PlexusIoZipFileResourceCollectionTest.java | 14 +++--- .../plexus/archiver/zip/ZipArchiverTest.java | 46 +++++++++---------- .../archiver/zip/ZipUnArchiverTest.java | 22 ++++----- .../archiver/zstd/ZstdArchiverTest.java | 10 ++-- 40 files changed, 225 insertions(+), 228 deletions(-) diff --git a/.gitignore b/.gitignore index 50a04dfbd..94a3b6c9f 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,4 @@ bin *.iml *.iws .idea - - - +.DS_Store diff --git a/src/test/java/org/codehaus/plexus/archiver/AbstractArchiverTest.java b/src/test/java/org/codehaus/plexus/archiver/AbstractArchiverTest.java index b709ba0a8..1ef626806 100644 --- a/src/test/java/org/codehaus/plexus/archiver/AbstractArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/AbstractArchiverTest.java @@ -8,12 +8,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class AbstractArchiverTest { +class AbstractArchiverTest { private AbstractArchiver archiver; @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { this.archiver = new AbstractArchiver() { @Override @@ -34,7 +34,7 @@ protected void close() throws IOException { } @Test - public void testModesAndOverridesAreUnsetByDefault() { + void testModesAndOverridesAreUnsetByDefault() { assertEquals(-1, archiver.getDefaultFileMode()); assertEquals(-1, archiver.getOverrideFileMode()); @@ -43,13 +43,13 @@ public void testModesAndOverridesAreUnsetByDefault() { } @Test - public void testWhenUnsetModeUsesDefault() { + void testWhenUnsetModeUsesDefault() { assertEquals(Archiver.DEFAULT_FILE_MODE, archiver.getFileMode()); assertEquals(Archiver.DEFAULT_DIR_MODE, archiver.getDirectoryMode()); } @Test - public void testSetModeIsUsedWithFlagsForType() { + void testSetModeIsUsedWithFlagsForType() { archiver.setFileMode(0400); assertEquals(0100400, archiver.getFileMode()); @@ -58,7 +58,7 @@ public void testSetModeIsUsedWithFlagsForType() { } @Test - public void testSetDefaultIncludesFlagsForType() { + void testSetDefaultIncludesFlagsForType() { archiver.setDefaultFileMode(0400); assertEquals(0100400, archiver.getDefaultFileMode()); @@ -67,7 +67,7 @@ public void testSetDefaultIncludesFlagsForType() { } @Test - public void testDefaultIsUsedWhenModeIsUnset() { + void testDefaultIsUsedWhenModeIsUnset() { archiver.setDefaultFileMode(0400); assertEquals(0100400, archiver.getFileMode()); @@ -76,7 +76,7 @@ public void testDefaultIsUsedWhenModeIsUnset() { } @Test - public void testOverridesCanBeReset() { + void testOverridesCanBeReset() { archiver.setFileMode(0400); archiver.setFileMode(-1); assertEquals(-1, archiver.getOverrideFileMode()); @@ -87,7 +87,7 @@ public void testOverridesCanBeReset() { } @Test - public void testSetDestFileInTheWorkingDir() { + void testSetDestFileInTheWorkingDir() { archiver.setDestFile(new File("archive")); } } diff --git a/src/test/java/org/codehaus/plexus/archiver/AbstractUnArchiverTest.java b/src/test/java/org/codehaus/plexus/archiver/AbstractUnArchiverTest.java index 372d14fb3..a73ac715e 100644 --- a/src/test/java/org/codehaus/plexus/archiver/AbstractUnArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/AbstractUnArchiverTest.java @@ -36,11 +36,11 @@ * * @author Markus KARG */ -public class AbstractUnArchiverTest { +class AbstractUnArchiverTest { private AbstractUnArchiver abstractUnArchiver; @BeforeEach - public void setUp() { + void setUp() { this.abstractUnArchiver = new AbstractUnArchiver() { @Override protected void execute(final String path, final File outputDirectory) throws ArchiverException { @@ -55,13 +55,12 @@ protected void execute() throws ArchiverException { } @AfterEach - public void tearDown() { + void tearDown() { this.abstractUnArchiver = null; } @Test - public void shouldThrowExceptionBecauseRewrittenPathIsOutOfDirectory(@TempDir File targetFolder) - throws ArchiverException { + void shouldThrowExceptionBecauseRewrittenPathIsOutOfDirectory(@TempDir File targetFolder) throws ArchiverException { // given // The prefix includes the target directory name to make sure we catch cases when the paths @@ -82,7 +81,7 @@ public void shouldThrowExceptionBecauseRewrittenPathIsOutOfDirectory(@TempDir Fi } @Test - public void shouldExtractWhenFileOnDiskDoesNotExist(@TempDir File temporaryFolder) throws IOException { + void shouldExtractWhenFileOnDiskDoesNotExist(@TempDir File temporaryFolder) throws IOException { // given File file = new File(temporaryFolder, "whatever.txt"); // does not create the file! String entryname = file.getName(); @@ -96,7 +95,7 @@ public void shouldExtractWhenFileOnDiskDoesNotExist(@TempDir File temporaryFolde } @Test - public void shouldExtractWhenFileOnDiskIsNewerThanEntryInArchive(@TempDir File temporaryFolder) throws IOException { + void shouldExtractWhenFileOnDiskIsNewerThanEntryInArchive(@TempDir File temporaryFolder) throws IOException { // given File file = new File(temporaryFolder, "whatever.txt"); file.createNewFile(); @@ -112,8 +111,8 @@ public void shouldExtractWhenFileOnDiskIsNewerThanEntryInArchive(@TempDir File t } @Test - public void shouldExtractWhenFileOnDiskIsNewerThanEntryInArchive_andWarnAboutDifferentCasing( - @TempDir File temporaryFolder) throws IOException { + void shouldExtractWhenFileOnDiskIsNewerThanEntryInArchive_andWarnAboutDifferentCasing(@TempDir File temporaryFolder) + throws IOException { // given File file = new File(temporaryFolder, "whatever.txt"); file.createNewFile(); @@ -127,7 +126,7 @@ public void shouldExtractWhenFileOnDiskIsNewerThanEntryInArchive_andWarnAboutDif } @Test - public void shouldExtractWhenEntryInArchiveIsNewerThanFileOnDisk(@TempDir File temporaryFolder) throws IOException { + void shouldExtractWhenEntryInArchiveIsNewerThanFileOnDisk(@TempDir File temporaryFolder) throws IOException { // given File file = new File(temporaryFolder, "whatever.txt"); file.createNewFile(); @@ -143,8 +142,8 @@ public void shouldExtractWhenEntryInArchiveIsNewerThanFileOnDisk(@TempDir File t } @Test - public void shouldExtractWhenEntryInArchiveIsNewerThanFileOnDiskAndWarnAboutDifferentCasing( - @TempDir File temporaryFolder) throws IOException { + void shouldExtractWhenEntryInArchiveIsNewerThanFileOnDiskAndWarnAboutDifferentCasing(@TempDir File temporaryFolder) + throws IOException { // given File file = new File(temporaryFolder, "whatever.txt"); file.createNewFile(); @@ -161,7 +160,7 @@ public void shouldExtractWhenEntryInArchiveIsNewerThanFileOnDiskAndWarnAboutDiff } @Test - public void shouldNotWarnAboutDifferentCasingForDirectoryEntries(@TempDir File temporaryFolder) throws IOException { + void shouldNotWarnAboutDifferentCasingForDirectoryEntries(@TempDir File temporaryFolder) throws IOException { // given File file = new File(temporaryFolder, "whatever.txt"); file.createNewFile(); @@ -176,7 +175,7 @@ public void shouldNotWarnAboutDifferentCasingForDirectoryEntries(@TempDir File t } @Test - public void shouldExtractWhenCasingDifferOnlyInEntryNamePath(@TempDir File temporaryFolder) throws IOException { + void shouldExtractWhenCasingDifferOnlyInEntryNamePath(@TempDir File temporaryFolder) throws IOException { // given String entryName = "directory/whatever.txt"; File file = new File(temporaryFolder, entryName); // does not create the file! diff --git a/src/test/java/org/codehaus/plexus/archiver/DotDirectiveArchiveFinalizerTest.java b/src/test/java/org/codehaus/plexus/archiver/DotDirectiveArchiveFinalizerTest.java index 4d1912e5b..bcadc0f3b 100644 --- a/src/test/java/org/codehaus/plexus/archiver/DotDirectiveArchiveFinalizerTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/DotDirectiveArchiveFinalizerTest.java @@ -11,10 +11,10 @@ /** * @author Jason van Zyl */ -public class DotDirectiveArchiveFinalizerTest extends TestSupport { +class DotDirectiveArchiveFinalizerTest extends TestSupport { @Test - public void testDotDirectiveArchiveFinalizer() throws Exception { + void testDotDirectiveArchiveFinalizer() throws Exception { DotDirectiveArchiveFinalizer ddaf = new DotDirectiveArchiveFinalizer(new File(getBasedir(), "src/test/dotfiles")); @@ -40,7 +40,7 @@ public void testDotDirectiveArchiveFinalizer() throws Exception { } @Test - public void testDefaultDotDirectiveBehaviour() throws Exception { + void testDefaultDotDirectiveBehaviour() throws Exception { File dotFileDirectory = new File(getBasedir(), "src/test/dotfiles"); JarArchiver archiver = new JarArchiver(); diff --git a/src/test/java/org/codehaus/plexus/archiver/DuplicateFilesTest.java b/src/test/java/org/codehaus/plexus/archiver/DuplicateFilesTest.java index 565b4724f..3772b3f3f 100644 --- a/src/test/java/org/codehaus/plexus/archiver/DuplicateFilesTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/DuplicateFilesTest.java @@ -20,7 +20,7 @@ /** * @author Erik Engstrom */ -public class DuplicateFilesTest extends TestSupport { +class DuplicateFilesTest extends TestSupport { private static final File file1 = getTestFile("src/test/resources/group-writable/foo.txt"); @@ -29,7 +29,7 @@ public class DuplicateFilesTest extends TestSupport { private static final File destination = getTestFile("target/output/duplicateFiles"); @Test - public void testZipArchiver() throws Exception { + void testZipArchiver() throws Exception { Archiver archiver = lookup(Archiver.class, "zip"); archiver.setDuplicateBehavior(Archiver.DUPLICATES_SKIP); @@ -53,14 +53,14 @@ public void testZipArchiver() throws Exception { } @Test - public void testDirArchiver() throws Exception { + void testDirArchiver() throws Exception { Archiver archiver = lookup(Archiver.class, "dir"); createArchive(archiver, "dir"); testFinalFile("target/output/duplicateFiles.dir/duplicateFiles/foo.txt"); } @Test - public void testTarArchiver() throws Exception { + void testTarArchiver() throws Exception { TarArchiver archiver = (TarArchiver) lookup(Archiver.class, "tar"); archiver.setLongfile(TarLongFileMode.posix); archiver.setDuplicateBehavior(Archiver.DUPLICATES_SKIP); diff --git a/src/test/java/org/codehaus/plexus/archiver/EmptyDirectoryTest.java b/src/test/java/org/codehaus/plexus/archiver/EmptyDirectoryTest.java index 0d7009684..e12230b1d 100644 --- a/src/test/java/org/codehaus/plexus/archiver/EmptyDirectoryTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/EmptyDirectoryTest.java @@ -34,21 +34,21 @@ /** * @author Daniel Krisher */ -public class EmptyDirectoryTest extends TestSupport { +class EmptyDirectoryTest extends TestSupport { @Test - public void testZipArchiver() throws Exception { + void testZipArchiver() throws Exception { testEmptyDirectory("zip", lookup(Archiver.class, "zip")); } @Test - public void testJarArchiver() throws Exception { + void testJarArchiver() throws Exception { // No JAR UnArchiver implementation :( // testEmptyDirectory( "jar" ); } @Test - public void testTarArchiver() throws Exception { + void testTarArchiver() throws Exception { final TarArchiver tar = (TarArchiver) lookup(Archiver.class, "tar"); tar.setLongfile(TarLongFileMode.posix); testEmptyDirectory("tar", tar); diff --git a/src/test/java/org/codehaus/plexus/archiver/SymlinkTest.java b/src/test/java/org/codehaus/plexus/archiver/SymlinkTest.java index 7b8a4ebee..aeb607871 100644 --- a/src/test/java/org/codehaus/plexus/archiver/SymlinkTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/SymlinkTest.java @@ -20,11 +20,11 @@ /** * @author Kristian Rosenvold */ -public class SymlinkTest extends TestSupport { +class SymlinkTest extends TestSupport { @Test @DisabledOnOs(OS.WINDOWS) - public void testSymlinkDir() throws IOException { + void testSymlinkDir() throws IOException { File dummyContent = getTestFile("src/test/resources/symlinks/src/symDir"); assertTrue(dummyContent.isDirectory()); assertTrue(Files.isSymbolicLink(dummyContent.toPath())); @@ -32,7 +32,7 @@ public void testSymlinkDir() throws IOException { @Test @DisabledOnOs(OS.WINDOWS) - public void testSymlinkDirWithSlash() throws IOException { + void testSymlinkDirWithSlash() throws IOException { File dummyContent = getTestFile("src/test/resources/symlinks/src/symDir/"); assertTrue(dummyContent.isDirectory()); assertTrue(Files.isSymbolicLink(dummyContent.toPath())); @@ -40,14 +40,14 @@ public void testSymlinkDirWithSlash() throws IOException { @Test @DisabledOnOs(OS.WINDOWS) - public void testSymlinkFile() { + void testSymlinkFile() { File dummyContent = getTestFile("src/test/resources/symlinks/src/symR"); assertFalse(dummyContent.isDirectory()); assertTrue(Files.isSymbolicLink(dummyContent.toPath())); } @Test - public void testSymlinkTar() throws Exception { + void testSymlinkTar() throws Exception { TarArchiver archiver = (TarArchiver) lookup(Archiver.class, "tar"); archiver.setLongfile(TarLongFileMode.posix); @@ -65,7 +65,7 @@ public void testSymlinkTar() throws Exception { } @Test - public void testSymlinkZip() throws Exception { + void testSymlinkZip() throws Exception { ZipArchiver archiver = (ZipArchiver) lookup(Archiver.class, "zip"); File dummyContent = getTestFile("src/test/resources/symlinks/src"); @@ -85,7 +85,7 @@ public void testSymlinkZip() throws Exception { @Test @DisabledOnOs(OS.WINDOWS) - public void testSymlinkDirArchiver() throws Exception { + void testSymlinkDirArchiver() throws Exception { DirectoryArchiver archiver = (DirectoryArchiver) lookup(Archiver.class, "dir"); File dummyContent = getTestFile("src/test/resources/symlinks/src"); diff --git a/src/test/java/org/codehaus/plexus/archiver/bzip2/BZip2ArchiverTest.java b/src/test/java/org/codehaus/plexus/archiver/bzip2/BZip2ArchiverTest.java index 71f4e1ba5..b5b0c059b 100644 --- a/src/test/java/org/codehaus/plexus/archiver/bzip2/BZip2ArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/bzip2/BZip2ArchiverTest.java @@ -46,10 +46,10 @@ /** * @author Emmanuel Venisse */ -public class BZip2ArchiverTest extends BasePlexusArchiverTest { +class BZip2ArchiverTest extends BasePlexusArchiverTest { @Test - public void testCreateArchive() throws Exception { + void testCreateArchive() throws Exception { ZipArchiver zipArchiver = (ZipArchiver) lookup(Archiver.class, "zip"); zipArchiver.addDirectory(getTestFile("src")); zipArchiver.setDestFile(getTestFile("target/output/archiveForbz2.zip")); @@ -63,7 +63,7 @@ public void testCreateArchive() throws Exception { } @Test - public void testCreateEmptyArchive() throws Exception { + void testCreateEmptyArchive() throws Exception { BZip2Archiver archiver = (BZip2Archiver) lookup(Archiver.class, "bzip2"); archiver.setDestFile(getTestFile("target/output/empty.bz2")); try { @@ -75,7 +75,7 @@ public void testCreateEmptyArchive() throws Exception { } @Test - public void testCreateResourceCollection() throws Exception { + void testCreateResourceCollection() throws Exception { final File pomFile = new File("pom.xml"); final File bz2File = new File("target/output/pom.xml.bz2"); BZip2Archiver bzip2Archiver = (BZip2Archiver) lookup(Archiver.class, "bzip2"); @@ -111,7 +111,7 @@ public void testCreateResourceCollection() throws Exception { * @throws Exception */ @Test - public void testBz2IsForcedBehaviour() throws Exception { + void testBz2IsForcedBehaviour() throws Exception { BZip2Archiver bZip2Archiver = (BZip2Archiver) createArchiver("bzip2"); assertTrue(bZip2Archiver.isSupportingForced()); diff --git a/src/test/java/org/codehaus/plexus/archiver/gzip/GZipArchiverTest.java b/src/test/java/org/codehaus/plexus/archiver/gzip/GZipArchiverTest.java index d6a433df0..4c10c99f0 100644 --- a/src/test/java/org/codehaus/plexus/archiver/gzip/GZipArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/gzip/GZipArchiverTest.java @@ -46,10 +46,10 @@ /** * @author Emmanuel Venisse */ -public class GZipArchiverTest extends BasePlexusArchiverTest { +class GZipArchiverTest extends BasePlexusArchiverTest { @Test - public void testCreateArchive() throws Exception { + void testCreateArchive() throws Exception { ZipArchiver zipArchiver = (ZipArchiver) lookup(Archiver.class, "zip"); zipArchiver.addDirectory(getTestFile("src")); zipArchiver.setDestFile(getTestFile("target/output/archiveForGzip.zip")); @@ -63,7 +63,7 @@ public void testCreateArchive() throws Exception { } @Test - public void testCreateEmptyArchive() throws Exception { + void testCreateEmptyArchive() throws Exception { GZipArchiver archiver = (GZipArchiver) lookup(Archiver.class, "gzip"); archiver.setDestFile(getTestFile("target/output/empty.gz")); try { @@ -75,7 +75,7 @@ public void testCreateEmptyArchive() throws Exception { } @Test - public void testCreateResourceCollection() throws Exception { + void testCreateResourceCollection() throws Exception { final File pomFile = new File("pom.xml"); final File gzFile = new File("target/output/pom.xml.gz"); GZipArchiver gzipArchiver = (GZipArchiver) lookup(Archiver.class, "gzip"); @@ -108,7 +108,7 @@ public void testCreateResourceCollection() throws Exception { * @throws Exception */ @Test - public void testTarGzIsForcedBehaviour() throws Exception { + void testTarGzIsForcedBehaviour() throws Exception { GZipArchiver gZipArchiver = (GZipArchiver) createArchiver("gzip"); assertTrue(gZipArchiver.isSupportingForced()); diff --git a/src/test/java/org/codehaus/plexus/archiver/jar/BaseJarArchiverTest.java b/src/test/java/org/codehaus/plexus/archiver/jar/BaseJarArchiverTest.java index 902449ab6..c3335467b 100644 --- a/src/test/java/org/codehaus/plexus/archiver/jar/BaseJarArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/jar/BaseJarArchiverTest.java @@ -42,7 +42,7 @@ public abstract class BaseJarArchiverTest { * could create basic JAR file */ @Test - public void testCreateJar() throws IOException, ArchiverException { + void testCreateJar() throws IOException, ArchiverException { File jarFile = new File("target/output/testJar.jar"); jarFile.delete(); diff --git a/src/test/java/org/codehaus/plexus/archiver/jar/DirectoryArchiverUnpackJarTest.java b/src/test/java/org/codehaus/plexus/archiver/jar/DirectoryArchiverUnpackJarTest.java index 416f4f702..fe11d17e8 100644 --- a/src/test/java/org/codehaus/plexus/archiver/jar/DirectoryArchiverUnpackJarTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/jar/DirectoryArchiverUnpackJarTest.java @@ -17,7 +17,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; -public class DirectoryArchiverUnpackJarTest extends TestSupport { +class DirectoryArchiverUnpackJarTest extends TestSupport { public static final String[] DEFAULT_INCLUDES_ARRAY = {"**/*"}; @@ -34,7 +34,7 @@ public InputStream transform(@Nonnull PlexusIoResource resource, @Nonnull InputS } @Test - public void test_dependency_sets_depSet_unpacked_rdonly() throws Exception { + void test_dependency_sets_depSet_unpacked_rdonly() throws Exception { File src = new File("src/test/resources/unpack_issue.jar"); assertTrue(src.exists()); DefaultArchivedFileSet afs = DefaultArchivedFileSet.archivedFileSet(src); diff --git a/src/test/java/org/codehaus/plexus/archiver/jar/IndexTest.java b/src/test/java/org/codehaus/plexus/archiver/jar/IndexTest.java index 4a52e50e7..1ca3224cc 100644 --- a/src/test/java/org/codehaus/plexus/archiver/jar/IndexTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/jar/IndexTest.java @@ -30,10 +30,10 @@ /** * @author Richard van der Hoff */ -public class IndexTest extends TestSupport { +class IndexTest extends TestSupport { @Test - public void testCreateArchiveWithIndexedJars() throws Exception { + void testCreateArchiveWithIndexedJars() throws Exception { /* create a dummy jar */ JarArchiver archiver1 = (JarArchiver) lookup(Archiver.class, "jar"); archiver1.addFile(getTestFile("src/test/resources/manifests/manifest1.mf"), "one.txt"); @@ -75,7 +75,7 @@ public void testCreateArchiveWithIndexedJars() throws Exception { * tests for files in META-INF */ @Test - public void testCreateArchiveWithIndexedJarsAndMetaInf() throws Exception { + void testCreateArchiveWithIndexedJarsAndMetaInf() throws Exception { /* create a dummy jar */ JarArchiver archiver1 = (JarArchiver) lookup(Archiver.class, "jar"); archiver1.addFile(getTestFile("src/test/resources/manifests/manifest1.mf"), "one.txt"); diff --git a/src/test/java/org/codehaus/plexus/archiver/jar/JarArchiverTest.java b/src/test/java/org/codehaus/plexus/archiver/jar/JarArchiverTest.java index b98210928..a8081a37d 100644 --- a/src/test/java/org/codehaus/plexus/archiver/jar/JarArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/jar/JarArchiverTest.java @@ -20,13 +20,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class JarArchiverTest extends BaseJarArchiverTest { +class JarArchiverTest extends BaseJarArchiverTest { @TempDir private Path tempDir; @Test - public void testCreateManifestOnlyJar() throws IOException, ManifestException, ArchiverException { + void testCreateManifestOnlyJar() throws IOException, ManifestException, ArchiverException { File jarFile = Files.createTempFile(tempDir, "JarArchiverTest.", ".jar").toFile(); JarArchiver archiver = getJarArchiver(); @@ -44,7 +44,7 @@ public void testCreateManifestOnlyJar() throws IOException, ManifestException, A } @Test - public void testNonCompressed() throws IOException, ManifestException, ArchiverException { + void testNonCompressed() throws IOException, ManifestException, ArchiverException { File jarFile = new File("target/output/jarArchiveNonCompressed.jar"); JarArchiver archiver = getJarArchiver(); @@ -55,7 +55,7 @@ public void testNonCompressed() throws IOException, ManifestException, ArchiverE } @Test - public void testVeryLargeJar() throws IOException, ArchiverException { + void testVeryLargeJar() throws IOException, ArchiverException { // Generate some number of random files that is likely to be // two or three times the number of available file handles Random rand = new Random(); @@ -80,7 +80,7 @@ public void testVeryLargeJar() throws IOException, ArchiverException { } @Test - public void testReproducibleBuild() throws IOException, ManifestException, ParseException { + void testReproducibleBuild() throws IOException, ManifestException, ParseException { String[] tzList = { "America/Managua", "America/New_York", diff --git a/src/test/java/org/codehaus/plexus/archiver/jar/JarToolModularJarArchiverTest.java b/src/test/java/org/codehaus/plexus/archiver/jar/JarToolModularJarArchiverTest.java index a8552c3e3..8f0b95929 100644 --- a/src/test/java/org/codehaus/plexus/archiver/jar/JarToolModularJarArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/jar/JarToolModularJarArchiverTest.java @@ -38,7 +38,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; -public class JarToolModularJarArchiverTest extends BaseJarArchiverTest { +class JarToolModularJarArchiverTest extends BaseJarArchiverTest { private ModularJarArchiver archiver; @@ -46,7 +46,7 @@ public class JarToolModularJarArchiverTest extends BaseJarArchiverTest { * Configures the ModularJarArchiver for the test cases. */ @BeforeEach - public void setup() throws Exception { + void setup() throws Exception { File jarFile = new File("target/output/modular.jar"); jarFile.delete(); @@ -60,7 +60,7 @@ public void setup() throws Exception { */ @Test @EnabledIf("modulesAreSupported") - public void testModularJarWithMainClassAndVersion() throws Exception { + void testModularJarWithMainClassAndVersion() throws Exception { archiver.addDirectory(new File("src/test/resources/java-module-descriptor")); archiver.setModuleVersion("1.0.0"); archiver.setModuleMainClass("com.example.app.Main"); @@ -79,7 +79,7 @@ public void testModularJarWithMainClassAndVersion() throws Exception { */ @Test @EnabledIf("modulesAreSupported") - public void testModularJarWithManifestAndModuleMainClass() throws Exception { + void testModularJarWithManifestAndModuleMainClass() throws Exception { archiver.addDirectory(new File("src/test/resources/java-module-descriptor")); Manifest manifest = new Manifest(); manifest.addConfiguredAttribute(new Manifest.Attribute("Main-Class", "com.example.app.Main2")); @@ -101,7 +101,7 @@ public void testModularJarWithManifestAndModuleMainClass() throws Exception { */ @Test @EnabledIf("modulesAreSupported") - public void testModularJarWithManifestMainClassAttribute() throws Exception { + void testModularJarWithManifestMainClassAttribute() throws Exception { archiver.addDirectory(new File("src/test/resources/java-module-descriptor")); Manifest manifest = new Manifest(); manifest.addConfiguredAttribute(new Manifest.Attribute("Main-Class", "com.example.app.Main2")); @@ -120,7 +120,7 @@ public void testModularJarWithManifestMainClassAttribute() throws Exception { */ @Test @EnabledIf("modulesAreSupported") - public void testModularJar() throws Exception { + void testModularJar() throws Exception { archiver.addDirectory(new File("src/test/resources/java-module-descriptor")); archiver.createArchive(); @@ -133,7 +133,7 @@ public void testModularJar() throws Exception { */ @Test @EnabledIf("modulesAreSupported") - public void testInvalidModularJar() throws Exception { + void testInvalidModularJar() throws Exception { archiver.addDirectory(new File("src/test/resources/java-module-descriptor")); // Not a valid version archiver.setModuleVersion("notAValidVersion"); @@ -147,7 +147,7 @@ public void testInvalidModularJar() throws Exception { */ @Test @DisabledIf("modulesAreSupported") - public void testModularJarPriorJava9() throws Exception { + void testModularJarPriorJava9() throws Exception { archiver.addDirectory(new File("src/test/resources/java-module-descriptor")); archiver.setModuleVersion("1.0.0"); archiver.setModuleMainClass("com.example.app.Main"); @@ -165,7 +165,7 @@ public void testModularJarPriorJava9() throws Exception { */ @Test @EnabledIf("modulesAreSupported") - public void testNoCompression() throws Exception { + void testNoCompression() throws Exception { archiver.addDirectory(new File("src/test/resources/java-module-descriptor")); archiver.setCompress(false); @@ -189,7 +189,7 @@ public void testNoCompression() throws Exception { */ @Test @EnabledIf("modulesAreSupported") - public void testCompression() throws Exception { + void testCompression() throws Exception { archiver.addDirectory(new File("src/test/resources/java-module-descriptor")); archiver.addFile(new File("src/test/jars/test.jar"), "META-INF/lib/test.jar"); archiver.setRecompressAddedZips(false); @@ -215,7 +215,7 @@ public void testCompression() throws Exception { */ @Test @EnabledIf("modulesAreSupported") - public void testModularMultiReleaseJar() throws Exception { + void testModularMultiReleaseJar() throws Exception { // Add two module-info.class, one on the root and one on the multi-release dir. archiver.addFile( new File("src/test/resources/java-module-descriptor/module-info.class"), diff --git a/src/test/java/org/codehaus/plexus/archiver/jar/JdkManifestFactoryTest.java b/src/test/java/org/codehaus/plexus/archiver/jar/JdkManifestFactoryTest.java index 631fbdcee..53b4e6085 100644 --- a/src/test/java/org/codehaus/plexus/archiver/jar/JdkManifestFactoryTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/jar/JdkManifestFactoryTest.java @@ -17,10 +17,10 @@ /** * @author Kristian Rosenvold */ -public class JdkManifestFactoryTest extends TestSupport { +class JdkManifestFactoryTest extends TestSupport { @Test - public void testGetDefaultManifest() throws Exception { + void testGetDefaultManifest() throws Exception { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); Manifest manifest = JdkManifestFactory.getDefaultManifest(); manifest.write(byteArrayOutputStream); @@ -28,7 +28,7 @@ public void testGetDefaultManifest() throws Exception { } @Test - public void testGetDefaultManifestString() throws Exception { + void testGetDefaultManifestString() throws Exception { Manifest manifest = getManifest("src/test/resources/manifests/manifestWithClassPath.mf"); Manifest manifestWithout = getManifest("src/test/resources/manifests/manifest1.mf"); String value = manifest.getMainAttributes().getValue(ManifestConstants.ATTRIBUTE_CLASSPATH); @@ -40,7 +40,7 @@ public void testGetDefaultManifestString() throws Exception { } @Test - public void testIllegals() throws ManifestException, IOException { + void testIllegals() throws ManifestException, IOException { Manifest manifest = getManifest("src/test/resources/manifests/manifest6.mf"); assertNotNull(manifest); @@ -53,7 +53,7 @@ public void testIllegals() throws ManifestException, IOException { } @Test - public void testMerge() throws ManifestException, IOException { + void testMerge() throws ManifestException, IOException { Manifest manifest1 = getManifest("src/test/resources/manifests/manifestMerge1.mf"); Manifest manifest2 = getManifest("src/test/resources/manifests/manifestMerge2.mf"); @@ -80,7 +80,7 @@ public void testMerge() throws ManifestException, IOException { } @Test - public void testDualClassPath() throws ManifestException, IOException { + void testDualClassPath() throws ManifestException, IOException { Manifest manifest = getManifest("src/test/resources/manifests/manifestWithDualClassPath.mf"); final Attributes mainAttributes = manifest.getMainAttributes(); final String attribute = mainAttributes.getValue("Class-Path"); diff --git a/src/test/java/org/codehaus/plexus/archiver/jar/ManifestTest.java b/src/test/java/org/codehaus/plexus/archiver/jar/ManifestTest.java index 68049b67c..2493afa37 100644 --- a/src/test/java/org/codehaus/plexus/archiver/jar/ManifestTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/jar/ManifestTest.java @@ -34,17 +34,17 @@ /** * @author Emmanuel Venisse */ -public class ManifestTest extends TestSupport { +class ManifestTest extends TestSupport { @Test - public void testManifest1() throws Exception { + void testManifest1() throws Exception { Manifest manifest = getManifest("src/test/resources/manifests/manifest1.mf"); String version = manifest.getManifestVersion(); assertEquals("1.0", version, "Manifest was not created with correct version - "); } @Test - public void testManifest2() throws Exception { + void testManifest2() throws Exception { try { getManifest("src/test/resources/manifests/manifest2.mf"); fail("Manifest isn't well formed. It must be generate an exception."); @@ -53,7 +53,7 @@ public void testManifest2() throws Exception { } @Test - public void testManifest3() throws Exception { + void testManifest3() throws Exception { try { getManifest("src/test/resources/manifests/manifest3.mf"); fail("Manifest isn't well formed. It must be generate an exception."); @@ -62,7 +62,7 @@ public void testManifest3() throws Exception { } @Test - public void testManifest5() throws Exception { + void testManifest5() throws Exception { try { getManifest("src/test/resources/manifests/manifest5.mf"); fail(); @@ -71,7 +71,7 @@ public void testManifest5() throws Exception { } @Test - public void testAddConfiguredSection() throws ManifestException { + void testAddConfiguredSection() throws ManifestException { Manifest manifest = new Manifest(); Manifest.Section section = new Manifest.Section(); section.setName("fud"); @@ -81,7 +81,7 @@ public void testAddConfiguredSection() throws ManifestException { } @Test - public void testAttributeLongLineWrite() throws Exception { + void testAttributeLongLineWrite() throws Exception { StringWriter writer = new StringWriter(); Manifest.Attribute attr = new Manifest.Attribute(); String longLineOfChars = "123456789 123456789 123456789 123456789 123456789 123456789 123456789 " @@ -98,7 +98,7 @@ public void testAttributeLongLineWrite() throws Exception { } @Test - public void testAttributeLongLineWriteNonAscii() throws Exception { + void testAttributeLongLineWriteNonAscii() throws Exception { StringWriter writer = new StringWriter(); Manifest.Attribute attr = new Manifest.Attribute(); String longLineOfChars = "Ед докэндё форынчйбюж зкрипторэм векж, льабятюр ыкжпэтэндяз мэль ут, квюо ут модо " @@ -126,7 +126,7 @@ public void testAttributeLongLineWriteNonAscii() throws Exception { } @Test - public void testDualClassPath() throws ManifestException, IOException { + void testDualClassPath() throws ManifestException, IOException { Manifest manifest = getManifest("src/test/resources/manifests/manifestWithDualClassPath.mf"); final String attribute = manifest.getMainSection().getAttributeValue("Class-Path"); // According to discussions, we drop support for duplicate class-path attribute @@ -134,20 +134,20 @@ public void testDualClassPath() throws ManifestException, IOException { } @Test - public void testAttributeMultiLineValue() throws Exception { + void testAttributeMultiLineValue() throws Exception { checkMultiLineAttribute( "123456789" + Manifest.EOL + "123456789", "123456789" + Manifest.EOL + " 123456789" + Manifest.EOL); } @Test - public void testAttributeDifferentLineEndings() throws Exception { + void testAttributeDifferentLineEndings() throws Exception { checkMultiLineAttribute( "\tA\rB\n\t C\r\n \tD\n\r", "\tA" + Manifest.EOL + " B" + Manifest.EOL + " \t C" + Manifest.EOL + " \tD" + Manifest.EOL); } @Test - public void testAddAttributes() throws ManifestException, IOException { + void testAddAttributes() throws ManifestException, IOException { Manifest manifest = getManifest("src/test/resources/manifests/manifestMerge1.mf"); Manifest.ExistingSection fudz = manifest.getSection("Fudz"); fudz.addConfiguredAttribute(new Manifest.Attribute("boz", "bzz")); @@ -156,7 +156,7 @@ public void testAddAttributes() throws ManifestException, IOException { } @Test - public void testRemoveAttributes() throws ManifestException, IOException { + void testRemoveAttributes() throws ManifestException, IOException { Manifest manifest = getManifest("src/test/resources/manifests/manifestMerge1.mf"); Manifest.ExistingSection fudz = manifest.getSection("Fudz"); fudz.addConfiguredAttribute(new Manifest.Attribute("boz", "bzz")); @@ -166,7 +166,7 @@ public void testRemoveAttributes() throws ManifestException, IOException { } @Test - public void testAttributeSerialization() throws IOException, ManifestException { + void testAttributeSerialization() throws IOException, ManifestException { Manifest manifest = new Manifest(); manifest.getMainAttributes().putValue("mfa1", "fud1"); manifest.getMainSection().addAttributeAndCheck(new Manifest.Attribute("mfa2", "fud2")); @@ -184,7 +184,7 @@ public void testAttributeSerialization() throws IOException, ManifestException { } @Test - public void testDefaultBehaviour() { + void testDefaultBehaviour() { Manifest manifest = new Manifest(); Manifest.ExistingSection mainSection = manifest.getMainSection(); assertNotNull(mainSection); @@ -194,7 +194,7 @@ public void testDefaultBehaviour() { } @Test - public void testGetDefaultManifest() throws Exception { + void testGetDefaultManifest() throws Exception { java.util.jar.Manifest mf = Manifest.getDefaultManifest(); java.util.jar.Attributes mainAttributes = mf.getMainAttributes(); assertEquals(2, mainAttributes.size()); @@ -207,7 +207,7 @@ public void testGetDefaultManifest() throws Exception { assertTrue(mainAttributes.containsKey(new java.util.jar.Attributes.Name("Manifest-Version"))); } - public void checkMultiLineAttribute(String in, String expected) throws Exception { + void checkMultiLineAttribute(String in, String expected) throws Exception { StringWriter writer = new StringWriter(); Manifest.Attribute attr = new Manifest.Attribute(); attr.setName("test"); @@ -251,7 +251,7 @@ private static String dumpString(String in) { } @Test - public void testAddAttributesPlexusManifest() throws ManifestException, IOException { + void testAddAttributesPlexusManifest() throws ManifestException, IOException { Manifest manifest = getManifest("src/test/resources/manifests/manifestMerge1.mf"); Manifest.ExistingSection fudz = manifest.getSection("Fudz"); fudz.addConfiguredAttribute(new Manifest.Attribute("boz", "bzz")); @@ -259,7 +259,7 @@ public void testAddAttributesPlexusManifest() throws ManifestException, IOExcept } @Test - public void testRemoveAttributesPlexusManifest() throws ManifestException, IOException { + void testRemoveAttributesPlexusManifest() throws ManifestException, IOException { Manifest manifest = getManifest("src/test/resources/manifests/manifestMerge1.mf"); Manifest.ExistingSection fudz = manifest.getSection("Fudz"); fudz.addConfiguredAttribute(new Manifest.Attribute("boz", "bzz")); @@ -269,7 +269,7 @@ public void testRemoveAttributesPlexusManifest() throws ManifestException, IOExc } @Test - public void testAttributeSerializationPlexusManifest() throws IOException, ManifestException { + void testAttributeSerializationPlexusManifest() throws IOException, ManifestException { Manifest manifest = new Manifest(); manifest.getMainSection().addConfiguredAttribute(new Manifest.Attribute("mfa1", "fud1")); manifest.getMainSection().addConfiguredAttribute(new Manifest.Attribute("mfa2", "fud2")); @@ -288,7 +288,7 @@ public void testAttributeSerializationPlexusManifest() throws IOException, Manif } @Test - public void testClassPathPlexusManifest() throws ManifestException { + void testClassPathPlexusManifest() throws ManifestException { Manifest manifest = new Manifest(); manifest.addConfiguredAttribute(new Manifest.Attribute(ManifestConstants.ATTRIBUTE_CLASSPATH, "fud")); manifest.addConfiguredAttribute(new Manifest.Attribute(ManifestConstants.ATTRIBUTE_CLASSPATH, "duf")); @@ -296,7 +296,7 @@ public void testClassPathPlexusManifest() throws ManifestException { } @Test - public void testAddConfiguredSectionPlexusManifest() throws ManifestException { + void testAddConfiguredSectionPlexusManifest() throws ManifestException { Manifest manifest = new Manifest(); Manifest.Section section = new Manifest.Section(); section.setName("fud"); diff --git a/src/test/java/org/codehaus/plexus/archiver/rar/RarArchiverTest.java b/src/test/java/org/codehaus/plexus/archiver/rar/RarArchiverTest.java index 1c4bc418c..609e06ff4 100644 --- a/src/test/java/org/codehaus/plexus/archiver/rar/RarArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/rar/RarArchiverTest.java @@ -32,7 +32,7 @@ * @author olamy * @since 13 mars 07 */ -public class RarArchiverTest extends BasePlexusArchiverTest { +class RarArchiverTest extends BasePlexusArchiverTest { public File getTargetRarFolder() { return new File(getBasedir(), "/target/rartest/"); @@ -49,7 +49,7 @@ public void setUp() throws Exception { } @Test - public void testArchive() throws Exception { + void testArchive() throws Exception { Archiver archiver = lookup(Archiver.class, "rar"); archiver.setDestFile(new File(getTargetRarFolder(), "test.rar")); // archiver.addDirectory( , "manifests" ); @@ -70,7 +70,7 @@ public void testArchive() throws Exception { } @Test - public void testUnarchive() throws Exception { + void testUnarchive() throws Exception { UnArchiver unArchiver = lookup(UnArchiver.class, "rar"); File rarFile = new File(getBasedir() + "/src/test/jars/test.rar"); @@ -92,7 +92,7 @@ public void testUnarchive() throws Exception { * @throws Exception */ @Test - public void testRarIsForcedBehaviour() throws Exception { + void testRarIsForcedBehaviour() throws Exception { Archiver rarArvhiver = createArchiver("rar"); assertTrue(rarArvhiver.isSupportingForced()); diff --git a/src/test/java/org/codehaus/plexus/archiver/sar/SarArchiverTest.java b/src/test/java/org/codehaus/plexus/archiver/sar/SarArchiverTest.java index 421b38a49..8f505d6f1 100644 --- a/src/test/java/org/codehaus/plexus/archiver/sar/SarArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/sar/SarArchiverTest.java @@ -22,10 +22,10 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; -public class SarArchiverTest extends BasePlexusArchiverTest { +class SarArchiverTest extends BasePlexusArchiverTest { @Test - public void testLookup() throws Exception { + void testLookup() throws Exception { ArchiverManager dam = lookup(ArchiverManager.class); PlexusIoResourceCollection sar = dam.getResourceCollection("sar"); assertNotNull(sar); diff --git a/src/test/java/org/codehaus/plexus/archiver/snappy/SnappyArchiverTest.java b/src/test/java/org/codehaus/plexus/archiver/snappy/SnappyArchiverTest.java index 9f20c7e0f..2ddd9cfda 100644 --- a/src/test/java/org/codehaus/plexus/archiver/snappy/SnappyArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/snappy/SnappyArchiverTest.java @@ -46,10 +46,10 @@ /** * Tests for the snappy archiver */ -public class SnappyArchiverTest extends BasePlexusArchiverTest { +class SnappyArchiverTest extends BasePlexusArchiverTest { @Test - public void testCreateArchive() throws Exception { + void testCreateArchive() throws Exception { ZipArchiver zipArchiver = (ZipArchiver) lookup(Archiver.class, "zip"); zipArchiver.addDirectory(getTestFile("src")); zipArchiver.setDestFile(getTestFile("target/output/archiveForSnappy.zip")); @@ -63,7 +63,7 @@ public void testCreateArchive() throws Exception { } @Test - public void testCreateEmptyArchive() throws Exception { + void testCreateEmptyArchive() throws Exception { SnappyArchiver archiver = (SnappyArchiver) lookup(Archiver.class, "snappy"); archiver.setDestFile(getTestFile("target/output/empty.snappy")); try { @@ -75,7 +75,7 @@ public void testCreateEmptyArchive() throws Exception { } @Test - public void testCreateResourceCollection() throws Exception { + void testCreateResourceCollection() throws Exception { final File pomFile = new File("pom.xml"); final File snappyFile = new File("target/output/pom.xml.snappy"); SnappyArchiver SnappyArchiver = (SnappyArchiver) lookup(Archiver.class, "snappy"); @@ -111,7 +111,7 @@ public void testCreateResourceCollection() throws Exception { * @throws Exception */ @Test - public void testsnappyIsForcedBehaviour() throws Exception { + void testsnappyIsForcedBehaviour() throws Exception { SnappyArchiver SnappyArchiver = (SnappyArchiver) createArchiver("snappy"); assertTrue(SnappyArchiver.isSupportingForced()); diff --git a/src/test/java/org/codehaus/plexus/archiver/tar/TarArchiverTest.java b/src/test/java/org/codehaus/plexus/archiver/tar/TarArchiverTest.java index 9c370bc17..2bbfbd06b 100644 --- a/src/test/java/org/codehaus/plexus/archiver/tar/TarArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/tar/TarArchiverTest.java @@ -65,13 +65,13 @@ /** * @author Emmanuel Venisse */ -public class TarArchiverTest extends TestSupport { +class TarArchiverTest extends TestSupport { @TempDir private File tempDir; @Test @DisabledOnOs(OS.WINDOWS) - public void testCreateArchiveWithDetectedModes() throws Exception { + void testCreateArchiveWithDetectedModes() throws Exception { String[] executablePaths = {"path/to/executable", "path/to/executable.bat"}; @@ -183,7 +183,7 @@ public void testCreateArchiveWithDetectedModes() throws Exception { } @Test - public void testCreateEmptyArchive() throws Exception { + void testCreateEmptyArchive() throws Exception { TarArchiver archiver = getPosixTarArchiver(); archiver.setDestFile(getTestFile("target/output/empty.tar")); try { @@ -195,7 +195,7 @@ public void testCreateEmptyArchive() throws Exception { } @Test - public void testUnicode() throws Exception { + void testUnicode() throws Exception { File tmpDir = getTestFile("src/test/resources/utf8"); TarArchiver archiver = getPosixTarArchiver(); File tarFile = getTestFile("target/output/tar-with-longFileName.tar"); @@ -221,12 +221,12 @@ private void writeFile(File dir, String fname, int mode) throws IOException, Arc } @Test - public void testCreateArchive() throws Exception { + void testCreateArchive() throws Exception { createArchive(0500, new int[] {0400, 0640, 0664}); createArchive(0500, new int[] {0400, 0640, 0664}); } - public void createArchive(final int directoryMode, final int fileModes[]) throws Exception { + void createArchive(final int directoryMode, final int fileModes[]) throws Exception { int defaultFileMode = fileModes[0]; int oneFileMode = fileModes[1]; int twoFileMode = fileModes[2]; @@ -281,7 +281,7 @@ public void createArchive(final int directoryMode, final int fileModes[]) throws } @Test - public void testCreateArchiveWithJiustASymlink() throws Exception { + void testCreateArchiveWithJiustASymlink() throws Exception { TarArchiver archiver = getPosixTarArchiver(); archiver.setDirectoryMode(0500); @@ -397,17 +397,17 @@ TarFile newTarFile(File tarFile) { } @Test - public void testUncompressedResourceCollection() throws Exception { + void testUncompressedResourceCollection() throws Exception { testCreateResourceCollection(new TarHandler()); } @Test - public void testGzipCompressedResourceCollection() throws Exception { + void testGzipCompressedResourceCollection() throws Exception { testCreateResourceCollection(new GZipTarHandler()); } @Test - public void testGzipFIleHandleLeak() throws Exception { + void testGzipFIleHandleLeak() throws Exception { GZipTarHandler tarHandler = new GZipTarHandler(); final File tarFile = tarHandler.createTarFile(); final File tarFile2 = tarHandler.createTarfile2(tarFile); @@ -419,12 +419,12 @@ public void testGzipFIleHandleLeak() throws Exception { } @Test - public void testBzip2CompressedResourceCollection() throws Exception { + void testBzip2CompressedResourceCollection() throws Exception { testCreateResourceCollection(new BZip2TarHandler()); } @Test - public void testTarFileNotClosingInputStream() throws Exception { + void testTarFileNotClosingInputStream() throws Exception { // Supposedly not closing the stream according to yjp. TarHandler tarHandler = new BZip2TarHandler(); final File fileName = tarHandler.createTarFile(); @@ -444,7 +444,7 @@ private void testCreateResourceCollection(TarHandler tarHandler) throws Exceptio } @Test - public void testSymlinkArchivedFileSet() throws Exception { + void testSymlinkArchivedFileSet() throws Exception { final File tarFile = getTestFile("src/test/resources/symlinks/symlinks.tar"); final File tarFile2 = getTestFile("target/output/pasymlinks-archivedFileset.tar"); final TarArchiver tarArchiver = getPosixTarArchiver(); diff --git a/src/test/java/org/codehaus/plexus/archiver/tar/TarBZip2UnArchiverTest.java b/src/test/java/org/codehaus/plexus/archiver/tar/TarBZip2UnArchiverTest.java index f2eaa9c39..b93bea884 100644 --- a/src/test/java/org/codehaus/plexus/archiver/tar/TarBZip2UnArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/tar/TarBZip2UnArchiverTest.java @@ -37,10 +37,10 @@ /** * @author Dan Tran */ -public class TarBZip2UnArchiverTest extends TestSupport { +class TarBZip2UnArchiverTest extends TestSupport { @Test - public void testExtract() throws Exception { + void testExtract() throws Exception { TarArchiver tarArchiver = (TarArchiver) lookup(Archiver.class, "tar"); tarArchiver.setLongfile(TarLongFileMode.posix); @@ -78,7 +78,7 @@ public void testExtract() throws Exception { } @Test - public void testLookup() throws Exception { + void testLookup() throws Exception { lookup(UnArchiver.class, "tar.bz2"); } } diff --git a/src/test/java/org/codehaus/plexus/archiver/tar/TarFileAttributesTest.java b/src/test/java/org/codehaus/plexus/archiver/tar/TarFileAttributesTest.java index 76155c444..64d28cc04 100644 --- a/src/test/java/org/codehaus/plexus/archiver/tar/TarFileAttributesTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/tar/TarFileAttributesTest.java @@ -22,7 +22,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; @SuppressWarnings("ResultOfMethodCallIgnored") -public class TarFileAttributesTest extends TestSupport { +class TarFileAttributesTest extends TestSupport { @TempDir private Path tempDir; @@ -44,7 +44,7 @@ private void printTestHeader() { @Test @DisabledOnOs(OS.WINDOWS) - public void testUseAttributesFromTarArchiveInputInTarArchiverOutput() throws Exception { + void testUseAttributesFromTarArchiveInputInTarArchiverOutput() throws Exception { printTestHeader(); File tempFile = @@ -96,7 +96,7 @@ public void testUseAttributesFromTarArchiveInputInTarArchiverOutput() throws Exc @Test @DisabledOnOs(OS.WINDOWS) - public void testUseDetectedFileAttributes() throws Exception { + void testUseDetectedFileAttributes() throws Exception { printTestHeader(); File tempFile = @@ -137,7 +137,7 @@ public void testUseDetectedFileAttributes() throws Exception { @Test @DisabledOnOs(OS.WINDOWS) - public void testOverrideDetectedFileAttributes() throws Exception { + void testOverrideDetectedFileAttributes() throws Exception { printTestHeader(); File tempFile = @@ -181,7 +181,7 @@ private TarArchiver getPosixCompliantTarArchiver() throws Exception { @Test @DisabledOnOs(OS.WINDOWS) - public void testOverrideDetectedFileAttributesUsingFileMode() throws Exception { + void testOverrideDetectedFileAttributesUsingFileMode() throws Exception { printTestHeader(); File tempFile = Files.createTempFile(tempDir, "tar-file-attributes.", ".tmp").toFile(); diff --git a/src/test/java/org/codehaus/plexus/archiver/tar/TarFileTest.java b/src/test/java/org/codehaus/plexus/archiver/tar/TarFileTest.java index bebce92c0..8a032db3d 100644 --- a/src/test/java/org/codehaus/plexus/archiver/tar/TarFileTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/tar/TarFileTest.java @@ -23,7 +23,7 @@ /** * Test case for {@link TarFile}. */ -public class TarFileTest extends TestSupport { +class TarFileTest extends TestSupport { private interface TarFileCreator { @@ -34,7 +34,7 @@ private interface TarFileCreator { * Test for the uncompressed tar file, {@link TarFile}. */ @Test - public void testTarFile() throws Exception { + void testTarFile() throws Exception { testTarFile(null, null, new TarFileCreator() { @Override @@ -48,7 +48,7 @@ public TarFile newTarFile(File file) throws IOException { * Test for the gzip compressed tar file, {@link GZipTarFile}. */ @Test - public void testGZipTarFile() throws Exception { + void testGZipTarFile() throws Exception { final GZipCompressor compressor = new GZipCompressor(); testTarFile(compressor, ".gz", new TarFileCreator() { @@ -63,7 +63,7 @@ public TarFile newTarFile(File file) throws IOException { * Test for the bzip2 compressed tar file, {@link BZip2TarFile}. */ @Test - public void testBZip2TarFile() throws Exception { + void testBZip2TarFile() throws Exception { final BZip2Compressor compressor = new BZip2Compressor(); testTarFile(compressor, ".bz2", new TarFileCreator() { diff --git a/src/test/java/org/codehaus/plexus/archiver/tar/TarGZipUnArchiverTest.java b/src/test/java/org/codehaus/plexus/archiver/tar/TarGZipUnArchiverTest.java index 02b887bf7..2e19b1885 100644 --- a/src/test/java/org/codehaus/plexus/archiver/tar/TarGZipUnArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/tar/TarGZipUnArchiverTest.java @@ -37,10 +37,10 @@ /** * @author Dan Tran */ -public class TarGZipUnArchiverTest extends TestSupport { +class TarGZipUnArchiverTest extends TestSupport { @Test - public void testExtract() throws Exception { + void testExtract() throws Exception { TarArchiver tarArchiver = (TarArchiver) lookup(Archiver.class, "tar"); tarArchiver.setLongfile(TarLongFileMode.posix); @@ -76,7 +76,7 @@ public void testExtract() throws Exception { } @Test - public void testLookup() throws Exception { + void testLookup() throws Exception { lookup(UnArchiver.class, "tar.gz"); } } diff --git a/src/test/java/org/codehaus/plexus/archiver/tar/TarRoundTripTest.java b/src/test/java/org/codehaus/plexus/archiver/tar/TarRoundTripTest.java index 8365236dc..00d66acf4 100644 --- a/src/test/java/org/codehaus/plexus/archiver/tar/TarRoundTripTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/tar/TarRoundTripTest.java @@ -32,7 +32,7 @@ /** * from org.apache.ant.tools.tar.TarRoundTripTest v1.6 */ -public class TarRoundTripTest { +class TarRoundTripTest { private static final String LONG_NAME = "this/path/name/contains/more/than/one/hundred/characters/in/order/" + "to/test/the/GNU/long/file/name/capability/round/tripped"; @@ -41,7 +41,7 @@ public class TarRoundTripTest { * test round-tripping long (GNU) entries */ @Test - public void testLongRoundTripping() throws IOException { + void testLongRoundTripping() throws IOException { TarArchiveEntry original = new TarArchiveEntry(LONG_NAME); assertTrue(LONG_NAME.length() > 100, "over 100 chars"); assertEquals(LONG_NAME, original.getName(), "original name"); diff --git a/src/test/java/org/codehaus/plexus/archiver/tar/TarSnappyUnArchiverTest.java b/src/test/java/org/codehaus/plexus/archiver/tar/TarSnappyUnArchiverTest.java index 4b9338573..dee6c32a3 100644 --- a/src/test/java/org/codehaus/plexus/archiver/tar/TarSnappyUnArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/tar/TarSnappyUnArchiverTest.java @@ -37,10 +37,10 @@ /** * Snappy tar archives */ -public class TarSnappyUnArchiverTest extends TestSupport { +class TarSnappyUnArchiverTest extends TestSupport { @Test - public void testExtract() throws Exception { + void testExtract() throws Exception { TarArchiver tarArchiver = (TarArchiver) lookup(Archiver.class, "tar"); tarArchiver.setLongfile(TarLongFileMode.posix); @@ -76,7 +76,7 @@ public void testExtract() throws Exception { } @Test - public void testLookup() throws Exception { + void testLookup() throws Exception { lookup(UnArchiver.class, "tar.snappy"); } } diff --git a/src/test/java/org/codehaus/plexus/archiver/tar/TarUnArchiverTest.java b/src/test/java/org/codehaus/plexus/archiver/tar/TarUnArchiverTest.java index c69aa4839..31691ce4e 100644 --- a/src/test/java/org/codehaus/plexus/archiver/tar/TarUnArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/tar/TarUnArchiverTest.java @@ -14,7 +14,7 @@ /** * @author Viktor Sadovnikov */ -public class TarUnArchiverTest extends TestSupport { +class TarUnArchiverTest extends TestSupport { private void runUnarchiver(FileSelector[] selectors, boolean[] results) throws Exception { String s = "target/tar-unarchiver-tests"; @@ -46,12 +46,12 @@ private void assertFileExistance(String s, String file, boolean exists) { } @Test - public void testExtractingADirectory() throws Exception { + void testExtractingADirectory() throws Exception { runUnarchiver(null, new boolean[] {true, true, true}); } @Test - public void testSelectors() throws Exception { + void testSelectors() throws Exception { IncludeExcludeFileSelector fileSelector = new IncludeExcludeFileSelector(); runUnarchiver(new FileSelector[] {fileSelector}, new boolean[] {true, true, true}); diff --git a/src/test/java/org/codehaus/plexus/archiver/tar/TarXzUnArchiverTest.java b/src/test/java/org/codehaus/plexus/archiver/tar/TarXzUnArchiverTest.java index f6432a768..6fda07418 100644 --- a/src/test/java/org/codehaus/plexus/archiver/tar/TarXzUnArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/tar/TarXzUnArchiverTest.java @@ -33,10 +33,10 @@ * @author philip.lourandos * @since 3.3 */ -public class TarXzUnArchiverTest extends TestSupport { +class TarXzUnArchiverTest extends TestSupport { @Test - public void testExtract() throws Exception { + void testExtract() throws Exception { TarArchiver tarArchiver = (TarArchiver) lookup(Archiver.class, "tar"); tarArchiver.setLongfile(TarLongFileMode.posix); @@ -82,7 +82,7 @@ public void testExtract() throws Exception { } @Test - public void testLookup() throws Exception { + void testLookup() throws Exception { assertNotNull(lookup(UnArchiver.class, "tar.xz")); } } diff --git a/src/test/java/org/codehaus/plexus/archiver/tar/TarZstdUnArchiverTest.java b/src/test/java/org/codehaus/plexus/archiver/tar/TarZstdUnArchiverTest.java index 563192f3f..1e355f1b2 100644 --- a/src/test/java/org/codehaus/plexus/archiver/tar/TarZstdUnArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/tar/TarZstdUnArchiverTest.java @@ -29,10 +29,10 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; -public class TarZstdUnArchiverTest extends TestSupport { +class TarZstdUnArchiverTest extends TestSupport { @Test - public void testExtract() throws Exception { + void testExtract() throws Exception { TarArchiver tarArchiver = (TarArchiver) lookup(Archiver.class, "tar"); tarArchiver.setLongfile(TarLongFileMode.posix); @@ -78,7 +78,7 @@ public void testExtract() throws Exception { } @Test - public void testLookup() throws Exception { + void testLookup() throws Exception { assertNotNull(lookup(UnArchiver.class, "tar.zst")); } } diff --git a/src/test/java/org/codehaus/plexus/archiver/util/ArchiveEntryUtilsTest.java b/src/test/java/org/codehaus/plexus/archiver/util/ArchiveEntryUtilsTest.java index 2d305e806..c0f27a5ce 100644 --- a/src/test/java/org/codehaus/plexus/archiver/util/ArchiveEntryUtilsTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/util/ArchiveEntryUtilsTest.java @@ -15,14 +15,14 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class ArchiveEntryUtilsTest { +class ArchiveEntryUtilsTest { @TempDir private Path tempDir; @Test @DisabledOnOs(OS.WINDOWS) - public void testChmodForFileWithDollarPLXCOMP164() throws Exception { + void testChmodForFileWithDollarPLXCOMP164() throws Exception { File temp = Files.createTempFile(tempDir, "A$A", "BB$").toFile(); ArchiveEntryUtils.chmod(temp, 0770); assert0770(temp); @@ -30,7 +30,7 @@ public void testChmodForFileWithDollarPLXCOMP164() throws Exception { @Test @DisabledOnOs(OS.WINDOWS) - public void testChmodWithJava7() throws Exception { + void testChmodWithJava7() throws Exception { File temp = Files.createTempFile(tempDir, "D$D", "BB$").toFile(); ArchiveEntryUtils.chmod(temp, 0770); assert0770(temp); diff --git a/src/test/java/org/codehaus/plexus/archiver/util/DefaultFileSetTest.java b/src/test/java/org/codehaus/plexus/archiver/util/DefaultFileSetTest.java index 2eadc6d71..0f8750e68 100644 --- a/src/test/java/org/codehaus/plexus/archiver/util/DefaultFileSetTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/util/DefaultFileSetTest.java @@ -10,10 +10,10 @@ /** * @author Kristian Rosenvold */ -public class DefaultFileSetTest { +class DefaultFileSetTest { @Test - public void testCreate() { + void testCreate() { final String[] includes = {"zz", "yy"}; final String[] exc = {"xx1", "xx2"}; final DefaultFileSet dfs = diff --git a/src/test/java/org/codehaus/plexus/archiver/util/FilePermissionUtilsTest.java b/src/test/java/org/codehaus/plexus/archiver/util/FilePermissionUtilsTest.java index a12a6a208..3b3f19cb8 100644 --- a/src/test/java/org/codehaus/plexus/archiver/util/FilePermissionUtilsTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/util/FilePermissionUtilsTest.java @@ -28,14 +28,14 @@ /** * @author Olivier Lamy */ -public class FilePermissionUtilsTest { +class FilePermissionUtilsTest { Logger getLogger() { return LoggerFactory.getLogger("foo"); } @Test - public void testOnlyWritableOnlyUser() throws Exception { + void testOnlyWritableOnlyUser() throws Exception { FilePermission fp = FilePermissionUtils.getFilePermissionFromMode("200", getLogger()); assertTrue(fp.isWritable()); assertTrue(fp.isOwnerOnlyWritable()); @@ -45,7 +45,7 @@ public void testOnlyWritableOnlyUser() throws Exception { } @Test - public void testExecAndRead() { + void testExecAndRead() { FilePermission fp = FilePermissionUtils.getFilePermissionFromMode("500", getLogger()); assertFalse(fp.isWritable()); assertTrue(fp.isOwnerOnlyWritable()); @@ -55,7 +55,7 @@ public void testExecAndRead() { } @Test - public void testAllUser() { + void testAllUser() { FilePermission fp = FilePermissionUtils.getFilePermissionFromMode("700", getLogger()); assertTrue(fp.isWritable()); assertTrue(fp.isOwnerOnlyWritable()); @@ -65,7 +65,7 @@ public void testAllUser() { } @Test - public void testAllAllUser() { + void testAllAllUser() { FilePermission fp = FilePermissionUtils.getFilePermissionFromMode("707", getLogger()); assertTrue(fp.isWritable()); assertFalse(fp.isOwnerOnlyWritable()); diff --git a/src/test/java/org/codehaus/plexus/archiver/war/WarArchiverTest.java b/src/test/java/org/codehaus/plexus/archiver/war/WarArchiverTest.java index 8597f43a7..534ed0604 100644 --- a/src/test/java/org/codehaus/plexus/archiver/war/WarArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/war/WarArchiverTest.java @@ -16,12 +16,12 @@ /** * @author Kristian Rosenvold */ -public class WarArchiverTest extends TestSupport { +class WarArchiverTest extends TestSupport { private final int expected = 8; @Test - public void testReAddingPlatformSpecificEncoding() throws Exception { + void testReAddingPlatformSpecificEncoding() throws Exception { WarArchiver archiver = (WarArchiver) lookup(Archiver.class, "war"); archiver.setDestFile(new File(getTargetRarFolder(), "test.war")); @@ -40,7 +40,7 @@ public void testReAddingPlatformSpecificEncoding() throws Exception { } @Test - public void testInfiniteRecursion() throws Exception { + void testInfiniteRecursion() throws Exception { WarArchiver archiver = (WarArchiver) lookup(Archiver.class, "war"); archiver.setDestFile(new File(getTargetRarFolder(), "test.war")); diff --git a/src/test/java/org/codehaus/plexus/archiver/xz/XzArchiverTest.java b/src/test/java/org/codehaus/plexus/archiver/xz/XzArchiverTest.java index 47a7793e7..3a039dcc0 100644 --- a/src/test/java/org/codehaus/plexus/archiver/xz/XzArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/xz/XzArchiverTest.java @@ -39,10 +39,10 @@ * @author philip.lourandos * @since 3.3 */ -public class XzArchiverTest extends BasePlexusArchiverTest { +class XzArchiverTest extends BasePlexusArchiverTest { @Test - public void testCreateArchive() throws Exception { + void testCreateArchive() throws Exception { ZipArchiver zipArchiver = (ZipArchiver) lookup(Archiver.class, "zip"); zipArchiver.addDirectory(getTestFile("src")); zipArchiver.setDestFile(getTestFile("target/output/archiveForxz.zip")); @@ -66,7 +66,7 @@ public void testCreateArchive() throws Exception { } @Test - public void testCreateEmptyArchive() throws Exception { + void testCreateEmptyArchive() throws Exception { XZArchiver archiver = (XZArchiver) lookup(Archiver.class, "xz"); archiver.setDestFile(getTestFile("target/output/empty.xz")); try { @@ -78,7 +78,7 @@ public void testCreateEmptyArchive() throws Exception { } @Test - public void testCreateResourceCollection() throws Exception { + void testCreateResourceCollection() throws Exception { final File pomFile = new File("pom.xml"); final File xzFile = new File("target/output/pom.xml.xz"); XZArchiver xzArchiver = (XZArchiver) lookup(Archiver.class, "xz"); @@ -114,7 +114,7 @@ public void testCreateResourceCollection() throws Exception { * @throws Exception */ @Test - public void testXzIsForcedBehaviour() throws Exception { + void testXzIsForcedBehaviour() throws Exception { XZArchiver xzArchiver = (XZArchiver) createArchiver("xz"); assertTrue(xzArchiver.isSupportingForced()); diff --git a/src/test/java/org/codehaus/plexus/archiver/zip/ConcurrentJarCreatorTest.java b/src/test/java/org/codehaus/plexus/archiver/zip/ConcurrentJarCreatorTest.java index 9a8bf2fe9..41a1e42e8 100644 --- a/src/test/java/org/codehaus/plexus/archiver/zip/ConcurrentJarCreatorTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/zip/ConcurrentJarCreatorTest.java @@ -16,10 +16,10 @@ @SuppressWarnings("ResultOfMethodCallIgnored") @Disabled -public class ConcurrentJarCreatorTest { +class ConcurrentJarCreatorTest { @Test - public void concurrent() throws Exception { + void concurrent() throws Exception { File home = new File(System.getProperty("user.home")); File result = new File(home, "multiStream2-parallel.zip"); ConcurrentJarCreator zipCreator = @@ -35,13 +35,13 @@ public void concurrent() throws Exception { } @Test - public void concurrent2() throws Exception { + void concurrent2() throws Exception { concurrent(); } @Test @Disabled - public void classic() throws Exception { + void classic() throws Exception { long startAt = System.currentTimeMillis(); File home = new File(System.getProperty("user.home")); File result = new File(home, "multiStream2-classic.zip"); diff --git a/src/test/java/org/codehaus/plexus/archiver/zip/PlexusArchiverZipFileResourceCollectionTest.java b/src/test/java/org/codehaus/plexus/archiver/zip/PlexusArchiverZipFileResourceCollectionTest.java index d0df3bfa9..ae018faa9 100644 --- a/src/test/java/org/codehaus/plexus/archiver/zip/PlexusArchiverZipFileResourceCollectionTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/zip/PlexusArchiverZipFileResourceCollectionTest.java @@ -17,10 +17,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -public class PlexusArchiverZipFileResourceCollectionTest extends TestSupport { +class PlexusArchiverZipFileResourceCollectionTest extends TestSupport { @Test - public void testFilesWithIllegalHtmlChars() throws Exception { + void testFilesWithIllegalHtmlChars() throws Exception { File testZip = new File(getBasedir(), "src/test/resources/archiveWithIllegalHtmlFileName.zip"); Set seen = new HashSet<>(); seen.add("AFileThatNeedsHtmlEsc%3F>"); @@ -39,7 +39,7 @@ public void testFilesWithIllegalHtmlChars() throws Exception { } @Test - public void testFileModes() throws IOException { + void testFileModes() throws IOException { File testZip = new File(getBasedir(), "src/test/resources/zeroFileMode/mixed-file-mode.zip"); Map originalUnixModes = new HashMap<>(); originalUnixModes.put("platform-fat", -1); diff --git a/src/test/java/org/codehaus/plexus/archiver/zip/PlexusIoZipFileResourceCollectionTest.java b/src/test/java/org/codehaus/plexus/archiver/zip/PlexusIoZipFileResourceCollectionTest.java index 9af093641..bcd2a9874 100644 --- a/src/test/java/org/codehaus/plexus/archiver/zip/PlexusIoZipFileResourceCollectionTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/zip/PlexusIoZipFileResourceCollectionTest.java @@ -23,10 +23,10 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class PlexusIoZipFileResourceCollectionTest extends TestSupport { +class PlexusIoZipFileResourceCollectionTest extends TestSupport { @Test - public void testNamelessRootFolder() throws Exception { + void testNamelessRootFolder() throws Exception { PlexusIoZipFileResourceCollection resourceCollection = new PlexusIoZipFileResourceCollection(); resourceCollection.setFile(getTestFile("src/test/jars/namelessrootfolder.jar")); Iterator iterator = resourceCollection.getResources(); @@ -38,7 +38,7 @@ public void testNamelessRootFolder() throws Exception { } @Test - public void testDescriptionForError() throws Exception { + void testDescriptionForError() throws Exception { PlexusIoZipFileResourceCollection resourceCollection = new PlexusIoZipFileResourceCollection(); resourceCollection.setFile(getTestFile("src/test/jars/namelessrootfolder.jar")); Iterator iterator = resourceCollection.getResources(); @@ -49,7 +49,7 @@ public void testDescriptionForError() throws Exception { } @Test - public void testFilesWithIllegalHtmlChars() throws Exception { + void testFilesWithIllegalHtmlChars() throws Exception { File testZip = new File(getBasedir(), "src/test/resources/bogusManifest.zip"); PlexusIoZipFileResourceCollection prc = new PlexusIoZipFileResourceCollection(); prc.setFile(testZip); @@ -66,7 +66,7 @@ public void testFilesWithIllegalHtmlChars() throws Exception { } @Test - public void testFilesThatAreNotThere() throws Exception { + void testFilesThatAreNotThere() throws Exception { File testZip = new File(getBasedir(), "src/test/resources/archiveWithIllegalHtmlFileName.zip"); Set seen = new HashSet<>(); seen.add("AFileThatNeedsHtmlEsc%3F>"); @@ -86,7 +86,7 @@ public void testFilesThatAreNotThere() throws Exception { } @Test - public void testSymlinkEntries() throws Exception { + void testSymlinkEntries() throws Exception { File testZip = new File(getBasedir(), "src/test/resources/symlinks/symlinks.zip"); Map symLinks = new HashMap<>(); symLinks.put("symDir", "targetDir/"); @@ -114,7 +114,7 @@ public void testSymlinkEntries() throws Exception { } @Test - public void testUnarchiveUnicodePathExtra() throws Exception { + void testUnarchiveUnicodePathExtra() throws Exception { PlexusIoZipFileResourceCollection prc = new PlexusIoZipFileResourceCollection(); prc.setFile(getTestFile("src/test/resources/unicodePathExtra/efsclear.zip")); Set names = new HashSet<>(); diff --git a/src/test/java/org/codehaus/plexus/archiver/zip/ZipArchiverTest.java b/src/test/java/org/codehaus/plexus/archiver/zip/ZipArchiverTest.java index fa8f3bfae..97af36d46 100644 --- a/src/test/java/org/codehaus/plexus/archiver/zip/ZipArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/zip/ZipArchiverTest.java @@ -92,13 +92,13 @@ * @author Emmanuel Venisse */ @SuppressWarnings("OctalInteger") -public class ZipArchiverTest extends BasePlexusArchiverTest { +class ZipArchiverTest extends BasePlexusArchiverTest { @TempDir private File tempDir; @Test - public void testImplicitPermissions() throws IOException { + void testImplicitPermissions() throws IOException { File zipFile = getTestFile("target/output/zip-with-implicit-dirmode.zip"); ZipArchiver archiver = getZipArchiver(zipFile); @@ -128,7 +128,7 @@ public void testImplicitPermissions() throws IOException { @Test @DisabledOnOs(OS.WINDOWS) - public void testOveriddenPermissions() throws IOException { + void testOveriddenPermissions() throws IOException { File zipFile = getTestFile("target/output/zip-with-overriden-modes.zip"); ZipArchiver archiver = getZipArchiver(zipFile); @@ -148,7 +148,7 @@ public void testOveriddenPermissions() throws IOException { @Test @DisabledOnOs(OS.WINDOWS) - public void testCreateArchiveWithDetectedModes() throws Exception { + void testCreateArchiveWithDetectedModes() throws Exception { String[] executablePaths = {"path/to/executable", "path/to/executable.bat"}; @@ -251,7 +251,7 @@ public void testCreateArchiveWithDetectedModes() throws Exception { } @Test - public void testCreateEmptyArchive() throws Exception { + void testCreateEmptyArchive() throws Exception { ZipArchiver archiver = getZipArchiver(); archiver.setDestFile(getTestFile("target/output/empty.zip")); try { @@ -297,14 +297,14 @@ private void writeFile(File dir, String fname, int mode) throws IOException, Arc } @Test - public void testCreateArchive() throws Exception { + void testCreateArchive() throws Exception { ZipArchiver archiver = newArchiver("archive1.zip"); createArchive(archiver); } @Test - public void testRecompressAddedZips() throws Exception { + void testRecompressAddedZips() throws Exception { // check that by default the zip archives are re-compressed final File zipFileRecompress = getTestFile("target/output/recompress-added-zips.zip"); @@ -356,7 +356,7 @@ public void testRecompressAddedZips() throws Exception { } @Test - public void testAddArchivedFileSet() throws Exception { + void testAddArchivedFileSet() throws Exception { File toBeAdded = new File("src/test/resources/test.zip"); DefaultArchivedFileSet sfd = DefaultArchivedFileSet.archivedFileSet(toBeAdded); File zipFIle = getTestFile("target/output/withZip.zip"); @@ -389,7 +389,7 @@ public InputStream transform(@Nonnull PlexusIoResource resource, @Nonnull InputS } @Test - public void testCreateArchiveWithStreamTransformer() throws IOException { + void testCreateArchiveWithStreamTransformer() throws IOException { InputStreamTransformer is = new InputStreamTransformer() { @Nonnull @@ -480,7 +480,7 @@ private void createArchive(ZipArchiver archiver) throws ArchiverException, IOExc @Test @DisabledOnOs(OS.WINDOWS) - public void testSymlinkZip() throws Exception { + void testSymlinkZip() throws Exception { final File zipFile = getTestFile("target/output/pasymlinks.zip"); final ZipArchiver zipArchiver = getZipArchiver(zipFile); PlexusIoFileResourceCollection files = new PlexusIoFileResourceCollection(); @@ -502,7 +502,7 @@ public void testSymlinkZip() throws Exception { @Test @DisabledOnOs(OS.WINDOWS) @SuppressWarnings("ResultOfMethodCallIgnored") - public void testSymlinkFileSet() throws Exception { + void testSymlinkFileSet() throws Exception { final File zipFile = getTestFile("target/output/pasymlinks-fileset.zip"); final ZipArchiver zipArchiver = getZipArchiver(zipFile); final DefaultFileSet fs = new DefaultFileSet(); @@ -521,7 +521,7 @@ public void testSymlinkFileSet() throws Exception { } @Test - public void testSymlinkArchivedFileSet() throws Exception { + void testSymlinkArchivedFileSet() throws Exception { final File zipFile = getTestFile("src/test/resources/symlinks/symlinks.zip"); final File zipFile2 = getTestFile("target/output/pasymlinks-archivedFileset.zip"); final ZipArchiver zipArchiver = getZipArchiver(zipFile2); @@ -538,7 +538,7 @@ public void testSymlinkArchivedFileSet() throws Exception { * Verify that ZipArchiver rounds up the last modified time. */ @Test - public void testLastModifiedTimeRounding() throws Exception { + void testLastModifiedTimeRounding() throws Exception { Path oddSecondsTimestampFile = Files.createTempFile(tempDir.toPath(), "odd-seconds-timestamp", null); // The milliseconds part is set to zero as not all filesystem support timestamp more granular than second. Files.setLastModifiedTime(oddSecondsTimestampFile, FileTime.fromMillis(1534189011_000L)); @@ -567,7 +567,7 @@ public void testLastModifiedTimeRounding() throws Exception { /* */ @Test - public void testForced() throws Exception { + void testForced() throws Exception { ZipArchiver archiver = newArchiver("archive2.zip"); assertTrue(archiver.isForced()); @@ -600,7 +600,7 @@ public void testForced() throws Exception { // Used to investigate extrafields @Test - public void testLookAtExtraZipFields_from_macos() throws IOException { + void testLookAtExtraZipFields_from_macos() throws IOException { InputStream fis = Streams.fileInputStream(new File("src/test/resources/zip-timestamp/macOsZipFile.zip")); ZipInputStream zis = new ZipInputStream(fis); final java.util.zip.ZipEntry evenEntry = zis.getNextEntry(); @@ -620,7 +620,7 @@ public void testLookAtExtraZipFields_from_macos() throws IOException { // Used to investigate date roundtrip behaviour across zip versions @Test - public void testZipStuff() throws IOException { + void testZipStuff() throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ZipOutputStream zos = new ZipOutputStream(baos); // name the file inside the zip file @@ -646,7 +646,7 @@ public void testZipStuff() throws IOException { @Disabled("Junit3 method name is notest") @Test - public void notestJustThatOne() throws Exception { + void notestJustThatOne() throws Exception { final File srcDir = new File("src"); String[] inc = {"test/java/org/codehaus/plexus/archiver/zip/ZipShortTest.java"}; final File zipFile = new File("target/output/zz1.zip"); @@ -661,7 +661,7 @@ public void notestJustThatOne() throws Exception { } @Test - public void testCreateResourceCollection() throws Exception { + void testCreateResourceCollection() throws Exception { final File srcDir = new File("src"); final File zipFile = new File("target/output/src.zip"); ZipArchiver zipArchiver = getZipArchiver(zipFile); @@ -685,7 +685,7 @@ public void testCreateResourceCollection() throws Exception { } @Test - public void testZipNonConcurrentResourceCollection() throws Exception { + void testZipNonConcurrentResourceCollection() throws Exception { final File tarFile = getTestFile("target/output/zip-non-concurrent.tar"); TarArchiver tarArchiver = (TarArchiver) lookup(Archiver.class, "tar"); // Override uId and gId - in standard mode on OS where uId or gId can have long values creation of tar can fail @@ -716,14 +716,14 @@ public void testZipNonConcurrentResourceCollection() throws Exception { } @Test - public void testDefaultUTF8() throws IOException { + void testDefaultUTF8() throws IOException { final ZipArchiver zipArchiver = getZipArchiver(new File("target/output/utf8-default.zip")); zipArchiver.addDirectory(new File("src/test/resources/miscUtf8")); zipArchiver.createArchive(); } @Test - public void testDefaultUTF8withUTF8() throws IOException { + void testDefaultUTF8withUTF8() throws IOException { final ZipArchiver zipArchiver = getZipArchiver(new File("target/output/utf8-with_utf.zip")); zipArchiver.setEncoding("UTF-8"); zipArchiver.addDirectory(new File("src/test/resources/miscUtf8")); @@ -731,7 +731,7 @@ public void testDefaultUTF8withUTF8() throws IOException { } @Test - public void testForcedFileModes() throws IOException { + void testForcedFileModes() throws IOException { File step1file = new File("target/output/forced-file-mode.zip"); { final ZipArchiver zipArchiver = getZipArchiver(step1file); @@ -791,7 +791,7 @@ public void testForcedFileModes() throws IOException { } @Test - public void testFixedEntryModificationTime() throws IOException { + void testFixedEntryModificationTime() throws IOException { final long almostMinDosTime = toLocalTimeZone(315532802000L); final File zipFile = getTestFile("target/output/zip-with-fixed-entry-modification-times.zip"); diff --git a/src/test/java/org/codehaus/plexus/archiver/zip/ZipUnArchiverTest.java b/src/test/java/org/codehaus/plexus/archiver/zip/ZipUnArchiverTest.java index e3c3e93be..222661a08 100644 --- a/src/test/java/org/codehaus/plexus/archiver/zip/ZipUnArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/zip/ZipUnArchiverTest.java @@ -23,10 +23,10 @@ /** * @author Jason van Zyl */ -public class ZipUnArchiverTest extends TestSupport { +class ZipUnArchiverTest extends TestSupport { @Test - public void testExtractingZipPreservesExecutableFlag() throws Exception { + void testExtractingZipPreservesExecutableFlag() throws Exception { String s = "target/zip-unarchiver-tests"; File testZip = new File(getBasedir(), "src/test/jars/test.zip"); @@ -48,7 +48,7 @@ public void testExtractingZipPreservesExecutableFlag() throws Exception { } @Test - public void testZeroFileModeInZip() throws Exception { + void testZeroFileModeInZip() throws Exception { String s = "target/zip-unarchiver-filemode-tests"; File testZip = new File(getBasedir(), "src/test/resources/zeroFileMode/foobar.zip"); @@ -72,7 +72,7 @@ public void testZeroFileModeInZip() throws Exception { } @Test - public void testUnarchiveUtf8() throws Exception { + void testUnarchiveUtf8() throws Exception { File dest = new File("target/output/unzip/utf8"); dest.mkdirs(); @@ -89,7 +89,7 @@ public void testUnarchiveUtf8() throws Exception { } @Test - public void testUnarchiveUnicodePathExtra() throws Exception { + void testUnarchiveUnicodePathExtra() throws Exception { File dest = new File("target/output/unzip/unicodePathExtra"); dest.mkdirs(); for (String name : dest.list()) { @@ -108,7 +108,7 @@ public void testUnarchiveUnicodePathExtra() throws Exception { } @Test - public void testUnarchiveUnicodePathExtraSelector() throws Exception { + void testUnarchiveUnicodePathExtraSelector() throws Exception { File dest = new File("target/output/unzip/unicodePathExtraSelector"); dest.mkdirs(); for (String name : dest.list()) { @@ -174,13 +174,13 @@ private ZipUnArchiver getZipUnArchiver(File testJar) throws Exception { } @Test - public void testExtractingADirectoryFromAJarFile() throws Exception { + void testExtractingADirectoryFromAJarFile() throws Exception { runUnarchiver("resources/artifactId", null, new boolean[] {true, true, false}); runUnarchiver("", null, new boolean[] {true, true, true}); } @Test - public void testSelectors() throws Exception { + void testSelectors() throws Exception { IncludeExcludeFileSelector fileSelector = new IncludeExcludeFileSelector(); runUnarchiver("", new FileSelector[] {fileSelector}, new boolean[] {true, true, true}); fileSelector.setExcludes(new String[] {"**/test.properties"}); @@ -193,7 +193,7 @@ public void testSelectors() throws Exception { } @Test - public void testExtractingZipWithEntryOutsideDestDirThrowsException() throws Exception { + void testExtractingZipWithEntryOutsideDestDirThrowsException() throws Exception { Exception ex = null; String s = "target/zip-unarchiver-slip-tests"; File testZip = new File(getBasedir(), "src/test/zips/zip-slip.zip"); @@ -213,7 +213,7 @@ public void testExtractingZipWithEntryOutsideDestDirThrowsException() throws Exc } @Test - public void testZipOutputSizeException() throws Exception { + void testZipOutputSizeException() throws Exception { Exception ex = null; String s = "target/zip-size-tests"; File testZip = new File(getBasedir(), "src/test/jars/test.zip"); @@ -234,7 +234,7 @@ public void testZipOutputSizeException() throws Exception { } @Test - public void testZipMaxOutputSizeEqualToExtractedFileSize() throws Exception { + void testZipMaxOutputSizeEqualToExtractedFileSize() throws Exception { long extractedFileSize = 11L; String s = "target/zip-size-tests"; File testZip = new File(getBasedir(), "src/test/jars/test.zip"); diff --git a/src/test/java/org/codehaus/plexus/archiver/zstd/ZstdArchiverTest.java b/src/test/java/org/codehaus/plexus/archiver/zstd/ZstdArchiverTest.java index 8023c129d..e305400de 100644 --- a/src/test/java/org/codehaus/plexus/archiver/zstd/ZstdArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/zstd/ZstdArchiverTest.java @@ -35,10 +35,10 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; -public class ZstdArchiverTest extends BasePlexusArchiverTest { +class ZstdArchiverTest extends BasePlexusArchiverTest { @Test - public void testCreateArchive() throws Exception { + void testCreateArchive() throws Exception { ZipArchiver zipArchiver = (ZipArchiver) lookup(Archiver.class, "zip"); zipArchiver.addDirectory(getTestFile("src")); zipArchiver.setDestFile(getTestFile("target/output/archiveForxz.zip")); @@ -62,7 +62,7 @@ public void testCreateArchive() throws Exception { } @Test - public void testCreateEmptyArchive() throws Exception { + void testCreateEmptyArchive() throws Exception { ZstdArchiver archiver = (ZstdArchiver) lookup(Archiver.class, "zst"); archiver.setDestFile(getTestFile("target/output/empty.zst")); try { @@ -74,7 +74,7 @@ public void testCreateEmptyArchive() throws Exception { } @Test - public void testCreateResourceCollection() throws Exception { + void testCreateResourceCollection() throws Exception { final File pomFile = new File("pom.xml"); final File zstFile = new File("target/output/pom.xml.zst"); ZstdArchiver zstdArchiver = (ZstdArchiver) lookup(Archiver.class, "zst"); @@ -110,7 +110,7 @@ public void testCreateResourceCollection() throws Exception { * @throws Exception */ @Test - public void testZstIsForcedBehaviour() throws Exception { + void testZstIsForcedBehaviour() throws Exception { ZstdArchiver zstdArchiver = (ZstdArchiver) createArchiver("zst"); assertTrue(zstdArchiver.isSupportingForced());