diff --git a/src/test/java/org/codehaus/plexus/archiver/AbstractArchiverTest.java b/src/test/java/org/codehaus/plexus/archiver/AbstractArchiverTest.java index 1ef62680..8d3f43b5 100644 --- a/src/test/java/org/codehaus/plexus/archiver/AbstractArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/AbstractArchiverTest.java @@ -34,7 +34,7 @@ protected void close() throws IOException { } @Test - void testModesAndOverridesAreUnsetByDefault() { + void modesAndOverridesAreUnsetByDefault() { assertEquals(-1, archiver.getDefaultFileMode()); assertEquals(-1, archiver.getOverrideFileMode()); @@ -43,13 +43,13 @@ void testModesAndOverridesAreUnsetByDefault() { } @Test - void testWhenUnsetModeUsesDefault() { + void whenUnsetModeUsesDefault() { assertEquals(Archiver.DEFAULT_FILE_MODE, archiver.getFileMode()); assertEquals(Archiver.DEFAULT_DIR_MODE, archiver.getDirectoryMode()); } @Test - void testSetModeIsUsedWithFlagsForType() { + void setModeIsUsedWithFlagsForType() { archiver.setFileMode(0400); assertEquals(0100400, archiver.getFileMode()); @@ -58,7 +58,7 @@ void testSetModeIsUsedWithFlagsForType() { } @Test - void testSetDefaultIncludesFlagsForType() { + void setDefaultIncludesFlagsForType() { archiver.setDefaultFileMode(0400); assertEquals(0100400, archiver.getDefaultFileMode()); @@ -67,7 +67,7 @@ void testSetDefaultIncludesFlagsForType() { } @Test - void testDefaultIsUsedWhenModeIsUnset() { + void defaultIsUsedWhenModeIsUnset() { archiver.setDefaultFileMode(0400); assertEquals(0100400, archiver.getFileMode()); @@ -76,7 +76,7 @@ void testDefaultIsUsedWhenModeIsUnset() { } @Test - void testOverridesCanBeReset() { + void overridesCanBeReset() { archiver.setFileMode(0400); archiver.setFileMode(-1); assertEquals(-1, archiver.getOverrideFileMode()); @@ -87,7 +87,7 @@ void testOverridesCanBeReset() { } @Test - void testSetDestFileInTheWorkingDir() { + void setDestFileInTheWorkingDir() { 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 a73ac715..a87c0225 100644 --- a/src/test/java/org/codehaus/plexus/archiver/AbstractUnArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/AbstractUnArchiverTest.java @@ -17,7 +17,6 @@ package org.codehaus.plexus.archiver; import java.io.File; -import java.io.IOException; import java.util.Date; import org.codehaus.plexus.components.io.filemappers.FileMapper; @@ -60,7 +59,7 @@ void tearDown() { } @Test - void shouldThrowExceptionBecauseRewrittenPathIsOutOfDirectory(@TempDir File targetFolder) throws ArchiverException { + void shouldThrowExceptionBecauseRewrittenPathIsOutOfDirectory(@TempDir File targetFolder) throws Exception { // given // The prefix includes the target directory name to make sure we catch cases when the paths @@ -81,7 +80,7 @@ void shouldThrowExceptionBecauseRewrittenPathIsOutOfDirectory(@TempDir File targ } @Test - void shouldExtractWhenFileOnDiskDoesNotExist(@TempDir File temporaryFolder) throws IOException { + void shouldExtractWhenFileOnDiskDoesNotExist(@TempDir File temporaryFolder) throws Exception { // given File file = new File(temporaryFolder, "whatever.txt"); // does not create the file! String entryname = file.getName(); @@ -95,7 +94,7 @@ void shouldExtractWhenFileOnDiskDoesNotExist(@TempDir File temporaryFolder) thro } @Test - void shouldExtractWhenFileOnDiskIsNewerThanEntryInArchive(@TempDir File temporaryFolder) throws IOException { + void shouldExtractWhenFileOnDiskIsNewerThanEntryInArchive(@TempDir File temporaryFolder) throws Exception { // given File file = new File(temporaryFolder, "whatever.txt"); file.createNewFile(); @@ -112,7 +111,7 @@ void shouldExtractWhenFileOnDiskIsNewerThanEntryInArchive(@TempDir File temporar @Test void shouldExtractWhenFileOnDiskIsNewerThanEntryInArchive_andWarnAboutDifferentCasing(@TempDir File temporaryFolder) - throws IOException { + throws Exception { // given File file = new File(temporaryFolder, "whatever.txt"); file.createNewFile(); @@ -126,7 +125,7 @@ void shouldExtractWhenFileOnDiskIsNewerThanEntryInArchive_andWarnAboutDifferentC } @Test - void shouldExtractWhenEntryInArchiveIsNewerThanFileOnDisk(@TempDir File temporaryFolder) throws IOException { + void shouldExtractWhenEntryInArchiveIsNewerThanFileOnDisk(@TempDir File temporaryFolder) throws Exception { // given File file = new File(temporaryFolder, "whatever.txt"); file.createNewFile(); @@ -143,7 +142,7 @@ void shouldExtractWhenEntryInArchiveIsNewerThanFileOnDisk(@TempDir File temporar @Test void shouldExtractWhenEntryInArchiveIsNewerThanFileOnDiskAndWarnAboutDifferentCasing(@TempDir File temporaryFolder) - throws IOException { + throws Exception { // given File file = new File(temporaryFolder, "whatever.txt"); file.createNewFile(); @@ -160,7 +159,7 @@ void shouldExtractWhenEntryInArchiveIsNewerThanFileOnDiskAndWarnAboutDifferentCa } @Test - void shouldNotWarnAboutDifferentCasingForDirectoryEntries(@TempDir File temporaryFolder) throws IOException { + void shouldNotWarnAboutDifferentCasingForDirectoryEntries(@TempDir File temporaryFolder) throws Exception { // given File file = new File(temporaryFolder, "whatever.txt"); file.createNewFile(); @@ -175,7 +174,7 @@ void shouldNotWarnAboutDifferentCasingForDirectoryEntries(@TempDir File temporar } @Test - void shouldExtractWhenCasingDifferOnlyInEntryNamePath(@TempDir File temporaryFolder) throws IOException { + void shouldExtractWhenCasingDifferOnlyInEntryNamePath(@TempDir File temporaryFolder) throws Exception { // 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 bcadc0f3..4ad8f6dc 100644 --- a/src/test/java/org/codehaus/plexus/archiver/DotDirectiveArchiveFinalizerTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/DotDirectiveArchiveFinalizerTest.java @@ -14,7 +14,7 @@ class DotDirectiveArchiveFinalizerTest extends TestSupport { @Test - void testDotDirectiveArchiveFinalizer() throws Exception { + void dotDirectiveArchiveFinalizer() throws Exception { DotDirectiveArchiveFinalizer ddaf = new DotDirectiveArchiveFinalizer(new File(getBasedir(), "src/test/dotfiles")); @@ -40,7 +40,7 @@ void testDotDirectiveArchiveFinalizer() throws Exception { } @Test - void testDefaultDotDirectiveBehaviour() throws Exception { + void defaultDotDirectiveBehaviour() 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 9083628a..5b3240b2 100644 --- a/src/test/java/org/codehaus/plexus/archiver/DuplicateFilesTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/DuplicateFilesTest.java @@ -29,7 +29,7 @@ class DuplicateFilesTest extends TestSupport { private static final File destination = getTestFile("target/output/duplicateFiles"); @Test - void testZipArchiver() throws Exception { + void zipArchiver() throws Exception { Archiver archiver = lookup(Archiver.class, "zip"); archiver.setDuplicateBehavior(Archiver.DUPLICATES_SKIP); @@ -55,14 +55,14 @@ void testZipArchiver() throws Exception { } @Test - void testDirArchiver() throws Exception { + void dirArchiver() throws Exception { Archiver archiver = lookup(Archiver.class, "dir"); createArchive(archiver, "dir"); testFinalFile("target/output/duplicateFiles.dir/duplicateFiles/foo.txt"); } @Test - void testTarArchiver() throws Exception { + void tarArchiver() 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 e12230b1..e7a202b5 100644 --- a/src/test/java/org/codehaus/plexus/archiver/EmptyDirectoryTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/EmptyDirectoryTest.java @@ -37,18 +37,18 @@ class EmptyDirectoryTest extends TestSupport { @Test - void testZipArchiver() throws Exception { + void zipArchiver() throws Exception { testEmptyDirectory("zip", lookup(Archiver.class, "zip")); } @Test - void testJarArchiver() throws Exception { + void jarArchiver() throws Exception { // No JAR UnArchiver implementation :( // testEmptyDirectory( "jar" ); } @Test - void testTarArchiver() throws Exception { + void tarArchiver() 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 b118e81b..f53cc5f3 100644 --- a/src/test/java/org/codehaus/plexus/archiver/SymlinkTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/SymlinkTest.java @@ -1,7 +1,6 @@ package org.codehaus.plexus.archiver; import java.io.File; -import java.io.IOException; import java.nio.file.Files; import org.codehaus.plexus.archiver.dir.DirectoryArchiver; @@ -24,7 +23,7 @@ class SymlinkTest extends TestSupport { @Test @DisabledOnOs(OS.WINDOWS) - void testSymlinkDir() throws IOException { + void symlinkDir() throws Exception { File dummyContent = getTestFile("src/test/resources/symlinks/src/symDir"); assertTrue(dummyContent.isDirectory()); assertTrue(Files.isSymbolicLink(dummyContent.toPath())); @@ -32,7 +31,7 @@ void testSymlinkDir() throws IOException { @Test @DisabledOnOs(OS.WINDOWS) - void testSymlinkDirWithSlash() throws IOException { + void symlinkDirWithSlash() throws Exception { File dummyContent = getTestFile("src/test/resources/symlinks/src/symDir/"); assertTrue(dummyContent.isDirectory()); assertTrue(Files.isSymbolicLink(dummyContent.toPath())); @@ -40,14 +39,14 @@ void testSymlinkDirWithSlash() throws IOException { @Test @DisabledOnOs(OS.WINDOWS) - void testSymlinkFile() { + void symlinkFile() { File dummyContent = getTestFile("src/test/resources/symlinks/src/symR"); assertFalse(dummyContent.isDirectory()); assertTrue(Files.isSymbolicLink(dummyContent.toPath())); } @Test - void testSymlinkTar() throws Exception { + void symlinkTar() throws Exception { TarArchiver archiver = (TarArchiver) lookup(Archiver.class, "tar"); archiver.setLongfile(TarLongFileMode.posix); @@ -67,7 +66,7 @@ void testSymlinkTar() throws Exception { } @Test - void testSymlinkZip() throws Exception { + void symlinkZip() throws Exception { ZipArchiver archiver = (ZipArchiver) lookup(Archiver.class, "zip"); File dummyContent = getTestFile("src/test/resources/symlinks/src"); @@ -89,7 +88,7 @@ void testSymlinkZip() throws Exception { @Test @DisabledOnOs(OS.WINDOWS) - void testSymlinkDirArchiver() throws Exception { + void symlinkDirArchiver() 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 b5b0c059..72ac87b0 100644 --- a/src/test/java/org/codehaus/plexus/archiver/bzip2/BZip2ArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/bzip2/BZip2ArchiverTest.java @@ -39,7 +39,7 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotSame; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; @@ -49,7 +49,7 @@ class BZip2ArchiverTest extends BasePlexusArchiverTest { @Test - void testCreateArchive() throws Exception { + void createArchive() throws Exception { ZipArchiver zipArchiver = (ZipArchiver) lookup(Archiver.class, "zip"); zipArchiver.addDirectory(getTestFile("src")); zipArchiver.setDestFile(getTestFile("target/output/archiveForbz2.zip")); @@ -63,7 +63,7 @@ void testCreateArchive() throws Exception { } @Test - void testCreateEmptyArchive() throws Exception { + void createEmptyArchive() throws Exception { BZip2Archiver archiver = (BZip2Archiver) lookup(Archiver.class, "bzip2"); archiver.setDestFile(getTestFile("target/output/empty.bz2")); try { @@ -75,7 +75,7 @@ void testCreateEmptyArchive() throws Exception { } @Test - void testCreateResourceCollection() throws Exception { + void createResourceCollection() 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 @@ void testCreateResourceCollection() throws Exception { * @throws Exception */ @Test - void testBz2IsForcedBehaviour() throws Exception { + void bz2IsForcedBehaviour() throws Exception { BZip2Archiver bZip2Archiver = (BZip2Archiver) createArchiver("bzip2"); assertTrue(bZip2Archiver.isSupportingForced()); @@ -128,7 +128,7 @@ void testBz2IsForcedBehaviour() throws Exception { final long firstRunTime = bZip2Archiver.getDestFile().lastModified(); - assertFalse(creationTime == firstRunTime); + assertNotSame(creationTime, firstRunTime); bZip2Archiver = (BZip2Archiver) createArchiver("bzip2"); 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 b48f1d0c..b464cda1 100644 --- a/src/test/java/org/codehaus/plexus/archiver/gzip/GZipArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/gzip/GZipArchiverTest.java @@ -49,7 +49,7 @@ class GZipArchiverTest extends BasePlexusArchiverTest { @Test - void testCreateArchive() throws Exception { + void createArchive() throws Exception { ZipArchiver zipArchiver = (ZipArchiver) lookup(Archiver.class, "zip"); zipArchiver.addDirectory(getTestFile("src")); zipArchiver.setDestFile(getTestFile("target/output/archiveForGzip.zip")); @@ -63,7 +63,7 @@ void testCreateArchive() throws Exception { } @Test - void testCreateEmptyArchive() throws Exception { + void createEmptyArchive() throws Exception { GZipArchiver archiver = (GZipArchiver) lookup(Archiver.class, "gzip"); archiver.setDestFile(getTestFile("target/output/empty.gz")); try { @@ -75,7 +75,7 @@ void testCreateEmptyArchive() throws Exception { } @Test - void testCreateResourceCollection() throws Exception { + void createResourceCollection() 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 @@ void testCreateResourceCollection() throws Exception { * @throws Exception */ @Test - void testTarGzIsForcedBehaviour() throws Exception { + void tarGzIsForcedBehaviour() 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 c3335467..6e43b8e3 100644 --- a/src/test/java/org/codehaus/plexus/archiver/jar/BaseJarArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/jar/BaseJarArchiverTest.java @@ -17,7 +17,6 @@ package org.codehaus.plexus.archiver.jar; import java.io.File; -import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; import java.nio.file.Paths; @@ -28,7 +27,6 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipFile; -import org.codehaus.plexus.archiver.ArchiverException; import org.codehaus.plexus.util.IOUtil; import org.junit.jupiter.api.Test; @@ -42,7 +40,7 @@ public abstract class BaseJarArchiverTest { * could create basic JAR file */ @Test - void testCreateJar() throws IOException, ArchiverException { + void createJar() throws Exception { 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 61cc037b..869b321d 100644 --- a/src/test/java/org/codehaus/plexus/archiver/jar/DirectoryArchiverUnpackJarTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/jar/DirectoryArchiverUnpackJarTest.java @@ -40,7 +40,7 @@ public InputStream transform(@Nonnull PlexusIoResource resource, @Nonnull InputS } @Test - void test_dependency_sets_depSet_unpacked_rdonly() throws Exception { + void dependency_sets_dep_set_unpacked_rdonly() throws Exception { File src = new File("src/test/resources/unpack_issue.jar"); File dest = new File("target/depset_unpack"); FileUtils.deleteDirectory(dest); @@ -61,7 +61,7 @@ void test_dependency_sets_depSet_unpacked_rdonly() throws Exception { } @Test - void test_dependency_sets_depSet_unpacked_by_default_dont_override() throws Exception { + void dependency_sets_dep_set_unpacked_by_default_dont_override() throws Exception { File src = new File("src/test/resources/unpack_issue.jar"); File dest = new File("target/depset_unpack_dont_override"); @@ -85,7 +85,7 @@ void test_dependency_sets_depSet_unpacked_by_default_dont_override() throws Exce } @Test - void test_dependency_sets_depSet_force_unpacked() throws Exception { + void dependency_sets_dep_set_force_unpacked() throws Exception { File src = new File("src/test/resources/unpack_issue.jar"); File dest = new File("target/depset_unpack_force"); 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 40fc162a..f16a0d29 100644 --- a/src/test/java/org/codehaus/plexus/archiver/jar/IndexTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/jar/IndexTest.java @@ -33,7 +33,7 @@ class IndexTest extends TestSupport { @Test - void testCreateArchiveWithIndexedJars() throws Exception { + void createArchiveWithIndexedJars() throws Exception { /* create a dummy jar */ JarArchiver archiver1 = (JarArchiver) lookup(Archiver.class, "jar"); archiver1.addFile(getTestFile("src/test/resources/manifests/manifest1.mf"), "one.txt"); @@ -77,7 +77,7 @@ void testCreateArchiveWithIndexedJars() throws Exception { * tests for files in META-INF */ @Test - void testCreateArchiveWithIndexedJarsAndMetaInf() throws Exception { + void createArchiveWithIndexedJarsAndMetaInf() 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 2bab6a15..cea31355 100644 --- a/src/test/java/org/codehaus/plexus/archiver/jar/JarArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/jar/JarArchiverTest.java @@ -15,7 +15,6 @@ import java.util.zip.ZipFile; import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; -import org.codehaus.plexus.archiver.ArchiverException; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; @@ -27,7 +26,7 @@ class JarArchiverTest extends BaseJarArchiverTest { private Path tempDir; @Test - void testCreateManifestOnlyJar() throws IOException, ManifestException, ArchiverException { + void createManifestOnlyJar() throws Exception { File jarFile = Files.createTempFile(tempDir, "JarArchiverTest.", ".jar").toFile(); JarArchiver archiver = getJarArchiver(); @@ -45,7 +44,7 @@ void testCreateManifestOnlyJar() throws IOException, ManifestException, Archiver } @Test - void testNonCompressed() throws IOException, ArchiverException { + void nonCompressed() throws Exception { File jarFile = new File("target/output/jarArchiveNonCompressed.jar"); JarArchiver archiver = getJarArchiver(); @@ -56,7 +55,7 @@ void testNonCompressed() throws IOException, ArchiverException { } @Test - void testVeryLargeJar() throws IOException, ArchiverException { + void veryLargeJar() throws Exception { // 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(); @@ -81,7 +80,7 @@ void testVeryLargeJar() throws IOException, ArchiverException { } @Test - void testReproducibleBuild() throws IOException, ManifestException, ParseException { + void reproducibleBuild() throws Exception { String[] tzList = { "America/Managua", "America/New_York", @@ -158,7 +157,7 @@ private void createReproducibleBuild(String timeZoneId) throws IOException, Mani * @throws ParseException */ @Test - public void testReproducibleUmask() throws IOException, ParseException { + void reproducibleUmask() throws Exception { Path jarFile = Files.createTempFile(tempDir, "JarArchiverTest-umask", ".jar"); JarArchiver archiver = getJarArchiver(); 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 8f0b9592..5b651551 100644 --- a/src/test/java/org/codehaus/plexus/archiver/jar/JarToolModularJarArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/jar/JarToolModularJarArchiverTest.java @@ -60,7 +60,7 @@ void setup() throws Exception { */ @Test @EnabledIf("modulesAreSupported") - void testModularJarWithMainClassAndVersion() throws Exception { + void modularJarWithMainClassAndVersion() 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 @@ void testModularJarWithMainClassAndVersion() throws Exception { */ @Test @EnabledIf("modulesAreSupported") - void testModularJarWithManifestAndModuleMainClass() throws Exception { + void modularJarWithManifestAndModuleMainClass() 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 @@ void testModularJarWithManifestAndModuleMainClass() throws Exception { */ @Test @EnabledIf("modulesAreSupported") - void testModularJarWithManifestMainClassAttribute() throws Exception { + void modularJarWithManifestMainClassAttribute() 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 @@ void testModularJarWithManifestMainClassAttribute() throws Exception { */ @Test @EnabledIf("modulesAreSupported") - void testModularJar() throws Exception { + void modularJar() throws Exception { archiver.addDirectory(new File("src/test/resources/java-module-descriptor")); archiver.createArchive(); @@ -133,7 +133,7 @@ void testModularJar() throws Exception { */ @Test @EnabledIf("modulesAreSupported") - void testInvalidModularJar() throws Exception { + void invalidModularJar() throws Exception { archiver.addDirectory(new File("src/test/resources/java-module-descriptor")); // Not a valid version archiver.setModuleVersion("notAValidVersion"); @@ -147,7 +147,7 @@ void testInvalidModularJar() throws Exception { */ @Test @DisabledIf("modulesAreSupported") - void testModularJarPriorJava9() throws Exception { + void modularJarPriorJava9() 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 @@ void testModularJarPriorJava9() throws Exception { */ @Test @EnabledIf("modulesAreSupported") - void testNoCompression() throws Exception { + void noCompression() throws Exception { archiver.addDirectory(new File("src/test/resources/java-module-descriptor")); archiver.setCompress(false); @@ -189,7 +189,7 @@ void testNoCompression() throws Exception { */ @Test @EnabledIf("modulesAreSupported") - void testCompression() throws Exception { + void compression() 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 @@ void testCompression() throws Exception { */ @Test @EnabledIf("modulesAreSupported") - void testModularMultiReleaseJar() throws Exception { + void modularMultiReleaseJar() 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 53b4e608..2c9f5273 100644 --- a/src/test/java/org/codehaus/plexus/archiver/jar/JdkManifestFactoryTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/jar/JdkManifestFactoryTest.java @@ -20,7 +20,7 @@ class JdkManifestFactoryTest extends TestSupport { @Test - void testGetDefaultManifest() throws Exception { + void getDefaultManifest() throws Exception { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); Manifest manifest = JdkManifestFactory.getDefaultManifest(); manifest.write(byteArrayOutputStream); @@ -28,7 +28,7 @@ void testGetDefaultManifest() throws Exception { } @Test - void testGetDefaultManifestString() throws Exception { + void getDefaultManifestString() 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 @@ void testGetDefaultManifestString() throws Exception { } @Test - void testIllegals() throws ManifestException, IOException { + void illegals() throws Exception { Manifest manifest = getManifest("src/test/resources/manifests/manifest6.mf"); assertNotNull(manifest); @@ -53,7 +53,7 @@ void testIllegals() throws ManifestException, IOException { } @Test - void testMerge() throws ManifestException, IOException { + void merge() throws Exception { Manifest manifest1 = getManifest("src/test/resources/manifests/manifestMerge1.mf"); Manifest manifest2 = getManifest("src/test/resources/manifests/manifestMerge2.mf"); @@ -80,7 +80,7 @@ void testMerge() throws ManifestException, IOException { } @Test - void testDualClassPath() throws ManifestException, IOException { + void dualClassPath() throws Exception { 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 2493afa3..62e616a4 100644 --- a/src/test/java/org/codehaus/plexus/archiver/jar/ManifestTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/jar/ManifestTest.java @@ -37,14 +37,14 @@ class ManifestTest extends TestSupport { @Test - void testManifest1() throws Exception { + void manifest1() 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 - void testManifest2() throws Exception { + void manifest2() 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 @@ void testManifest2() throws Exception { } @Test - void testManifest3() throws Exception { + void manifest3() 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 @@ void testManifest3() throws Exception { } @Test - void testManifest5() throws Exception { + void manifest5() throws Exception { try { getManifest("src/test/resources/manifests/manifest5.mf"); fail(); @@ -71,7 +71,7 @@ void testManifest5() throws Exception { } @Test - void testAddConfiguredSection() throws ManifestException { + void addConfiguredSection() throws Exception { Manifest manifest = new Manifest(); Manifest.Section section = new Manifest.Section(); section.setName("fud"); @@ -81,7 +81,7 @@ void testAddConfiguredSection() throws ManifestException { } @Test - void testAttributeLongLineWrite() throws Exception { + void attributeLongLineWrite() 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 @@ void testAttributeLongLineWrite() throws Exception { } @Test - void testAttributeLongLineWriteNonAscii() throws Exception { + void attributeLongLineWriteNonAscii() throws Exception { StringWriter writer = new StringWriter(); Manifest.Attribute attr = new Manifest.Attribute(); String longLineOfChars = "Ед докэндё форынчйбюж зкрипторэм векж, льабятюр ыкжпэтэндяз мэль ут, квюо ут модо " @@ -126,7 +126,7 @@ void testAttributeLongLineWriteNonAscii() throws Exception { } @Test - void testDualClassPath() throws ManifestException, IOException { + void dualClassPath() throws Exception { 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 @@ void testDualClassPath() throws ManifestException, IOException { } @Test - void testAttributeMultiLineValue() throws Exception { + void attributeMultiLineValue() throws Exception { checkMultiLineAttribute( "123456789" + Manifest.EOL + "123456789", "123456789" + Manifest.EOL + " 123456789" + Manifest.EOL); } @Test - void testAttributeDifferentLineEndings() throws Exception { + void attributeDifferentLineEndings() 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 - void testAddAttributes() throws ManifestException, IOException { + void addAttributes() throws Exception { 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 @@ void testAddAttributes() throws ManifestException, IOException { } @Test - void testRemoveAttributes() throws ManifestException, IOException { + void removeAttributes() throws Exception { 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 @@ void testRemoveAttributes() throws ManifestException, IOException { } @Test - void testAttributeSerialization() throws IOException, ManifestException { + void attributeSerialization() throws Exception { Manifest manifest = new Manifest(); manifest.getMainAttributes().putValue("mfa1", "fud1"); manifest.getMainSection().addAttributeAndCheck(new Manifest.Attribute("mfa2", "fud2")); @@ -184,7 +184,7 @@ void testAttributeSerialization() throws IOException, ManifestException { } @Test - void testDefaultBehaviour() { + void defaultBehaviour() { Manifest manifest = new Manifest(); Manifest.ExistingSection mainSection = manifest.getMainSection(); assertNotNull(mainSection); @@ -194,7 +194,7 @@ void testDefaultBehaviour() { } @Test - void testGetDefaultManifest() throws Exception { + void getDefaultManifest() throws Exception { java.util.jar.Manifest mf = Manifest.getDefaultManifest(); java.util.jar.Attributes mainAttributes = mf.getMainAttributes(); assertEquals(2, mainAttributes.size()); @@ -251,7 +251,7 @@ private static String dumpString(String in) { } @Test - void testAddAttributesPlexusManifest() throws ManifestException, IOException { + void addAttributesPlexusManifest() throws Exception { 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 @@ void testAddAttributesPlexusManifest() throws ManifestException, IOException { } @Test - void testRemoveAttributesPlexusManifest() throws ManifestException, IOException { + void removeAttributesPlexusManifest() throws Exception { 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 @@ void testRemoveAttributesPlexusManifest() throws ManifestException, IOException } @Test - void testAttributeSerializationPlexusManifest() throws IOException, ManifestException { + void attributeSerializationPlexusManifest() throws Exception { Manifest manifest = new Manifest(); manifest.getMainSection().addConfiguredAttribute(new Manifest.Attribute("mfa1", "fud1")); manifest.getMainSection().addConfiguredAttribute(new Manifest.Attribute("mfa2", "fud2")); @@ -288,7 +288,7 @@ void testAttributeSerializationPlexusManifest() throws IOException, ManifestExce } @Test - void testClassPathPlexusManifest() throws ManifestException { + void classPathPlexusManifest() throws Exception { 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 @@ void testClassPathPlexusManifest() throws ManifestException { } @Test - void testAddConfiguredSectionPlexusManifest() throws ManifestException { + void addConfiguredSectionPlexusManifest() throws Exception { Manifest manifest = new Manifest(); Manifest.Section section = new Manifest.Section(); section.setName("fud"); diff --git a/src/test/java/org/codehaus/plexus/archiver/manager/ArchiverManagerTest.java b/src/test/java/org/codehaus/plexus/archiver/manager/ArchiverManagerTest.java index 06a42165..a7e8906b 100644 --- a/src/test/java/org/codehaus/plexus/archiver/manager/ArchiverManagerTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/manager/ArchiverManagerTest.java @@ -99,7 +99,7 @@ private static Stream getResourceCollectionsForTests() { } @Test - void testReuseArchiver() throws Exception { + void reuseArchiver() throws Exception { ArchiverManager manager = lookup(ArchiverManager.class); Archiver archiver = manager.getArchiver("jar"); @@ -141,7 +141,7 @@ void allResourceCollectionsShouldBeUnderTest() { @ParameterizedTest @MethodSource("getArchiversForTests") - void testLookupArchiver(String archiveName) throws Exception { + void lookupArchiver(String archiveName) throws Exception { ArchiverManager manager = lookup(ArchiverManager.class); Archiver archiver = manager.getArchiver(archiveName); @@ -150,7 +150,7 @@ void testLookupArchiver(String archiveName) throws Exception { @ParameterizedTest @MethodSource("getUnArchiversForTests") - void testLookupUnArchiver(String archiveName) throws Exception { + void lookupUnArchiver(String archiveName) throws Exception { ArchiverManager manager = lookup(ArchiverManager.class); UnArchiver archiver = manager.getUnArchiver(archiveName); @@ -159,7 +159,7 @@ void testLookupUnArchiver(String archiveName) throws Exception { @ParameterizedTest @MethodSource("getResourceCollectionsForTests") - void testLookupResourceCollection(String resourceName) throws Exception { + void lookupResourceCollection(String resourceName) throws Exception { ArchiverManager manager = lookup(ArchiverManager.class); PlexusIoResourceCollection resourceCollection = manager.getResourceCollection(resourceName); @@ -167,21 +167,21 @@ void testLookupResourceCollection(String resourceName) throws Exception { } @Test - void testLookupUnknownArchiver() { + void lookupUnknownArchiver() { ArchiverManager manager = lookup(ArchiverManager.class); assertThrowsExactly(NoSuchArchiverException.class, () -> manager.getArchiver("Unknown")); } @Test - void testLookupUnknownUnArchiver() { + void lookupUnknownUnArchiver() { ArchiverManager manager = lookup(ArchiverManager.class); assertThrowsExactly(NoSuchArchiverException.class, () -> manager.getUnArchiver("Unknown")); } @Test - void testLookupUnknownResourceCollection() { + void lookupUnknownResourceCollection() { ArchiverManager manager = lookup(ArchiverManager.class); assertThrowsExactly(NoSuchArchiverException.class, () -> manager.getResourceCollection("Unknown")); @@ -189,7 +189,7 @@ void testLookupUnknownResourceCollection() { @ParameterizedTest @MethodSource("getUnArchiversForTests") - void testLookupUnArchiverUsingFile(String archiveName) throws Exception { + void lookupUnArchiverUsingFile(String archiveName) throws Exception { ArchiverManager manager = lookup(ArchiverManager.class); UnArchiver archiver = manager.getUnArchiver(new File("test", "test." + archiveName)); @@ -198,7 +198,7 @@ void testLookupUnArchiverUsingFile(String archiveName) throws Exception { @ParameterizedTest @MethodSource("getArchiversForTests") - void testLookupArchiverUsingFile(String archiveName) throws Exception { + void lookupArchiverUsingFile(String archiveName) throws Exception { ArchiverManager manager = lookup(ArchiverManager.class); Archiver archiver = manager.getArchiver(new File("test." + archiveName)); @@ -216,7 +216,7 @@ private static Stream getUnsupportedFiles() { @ParameterizedTest @MethodSource("getUnsupportedFiles") - void testUnsupportedLookupArchiverUsingFile(String fileName, String fileExtension) { + void unsupportedLookupArchiverUsingFile(String fileName, String fileExtension) { ArchiverManager manager = lookup(ArchiverManager.class); NoSuchArchiverException exception = assertThrowsExactly( @@ -227,7 +227,7 @@ void testUnsupportedLookupArchiverUsingFile(String fileName, String fileExtensio @ParameterizedTest @MethodSource("getUnsupportedFiles") - void testUnsupportedLookupUnArchiverUsingFile(String fileName, String fileExtension) { + void unsupportedLookupUnArchiverUsingFile(String fileName, String fileExtension) { ArchiverManager manager = lookup(ArchiverManager.class); NoSuchArchiverException exception = @@ -238,7 +238,7 @@ void testUnsupportedLookupUnArchiverUsingFile(String fileName, String fileExtens @ParameterizedTest @MethodSource("getUnsupportedFiles") - void testUnsupportedLookupResourceCollectionUsingFile(String fileName, String fileExtension) { + void unsupportedLookupResourceCollectionUsingFile(String fileName, String fileExtension) { ArchiverManager manager = lookup(ArchiverManager.class); NoSuchArchiverException exception = assertThrowsExactly( 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 609e06ff..d07a8989 100644 --- a/src/test/java/org/codehaus/plexus/archiver/rar/RarArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/rar/RarArchiverTest.java @@ -49,7 +49,7 @@ public void setUp() throws Exception { } @Test - void testArchive() throws Exception { + void archive() throws Exception { Archiver archiver = lookup(Archiver.class, "rar"); archiver.setDestFile(new File(getTargetRarFolder(), "test.rar")); // archiver.addDirectory( , "manifests" ); @@ -70,7 +70,7 @@ void testArchive() throws Exception { } @Test - void testUnarchive() throws Exception { + void unarchive() throws Exception { UnArchiver unArchiver = lookup(UnArchiver.class, "rar"); File rarFile = new File(getBasedir() + "/src/test/jars/test.rar"); @@ -92,7 +92,7 @@ void testUnarchive() throws Exception { * @throws Exception */ @Test - void testRarIsForcedBehaviour() throws Exception { + void rarIsForcedBehaviour() throws Exception { Archiver rarArvhiver = createArchiver("rar"); assertTrue(rarArvhiver.isSupportingForced()); 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 2ddd9cfd..e2ccf0c2 100644 --- a/src/test/java/org/codehaus/plexus/archiver/snappy/SnappyArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/snappy/SnappyArchiverTest.java @@ -49,7 +49,7 @@ class SnappyArchiverTest extends BasePlexusArchiverTest { @Test - void testCreateArchive() throws Exception { + void createArchive() throws Exception { ZipArchiver zipArchiver = (ZipArchiver) lookup(Archiver.class, "zip"); zipArchiver.addDirectory(getTestFile("src")); zipArchiver.setDestFile(getTestFile("target/output/archiveForSnappy.zip")); @@ -63,7 +63,7 @@ void testCreateArchive() throws Exception { } @Test - void testCreateEmptyArchive() throws Exception { + void createEmptyArchive() throws Exception { SnappyArchiver archiver = (SnappyArchiver) lookup(Archiver.class, "snappy"); archiver.setDestFile(getTestFile("target/output/empty.snappy")); try { @@ -75,7 +75,7 @@ void testCreateEmptyArchive() throws Exception { } @Test - void testCreateResourceCollection() throws Exception { + void createResourceCollection() 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"); 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 548599a0..66b5d72b 100644 --- a/src/test/java/org/codehaus/plexus/archiver/tar/TarArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/tar/TarArchiverTest.java @@ -70,7 +70,7 @@ class TarArchiverTest extends TestSupport { @Test @DisabledOnOs(OS.WINDOWS) - void testCreateArchiveWithDetectedModes() throws Exception { + void createArchiveWithDetectedModes() throws Exception { String[] executablePaths = {"path/to/executable", "path/to/executable.bat"}; @@ -182,7 +182,7 @@ void testCreateArchiveWithDetectedModes() throws Exception { } @Test - void testCreateEmptyArchive() throws Exception { + void createEmptyArchive() throws Exception { TarArchiver archiver = getPosixTarArchiver(); archiver.setDestFile(getTestFile("target/output/empty.tar")); try { @@ -194,7 +194,7 @@ void testCreateEmptyArchive() throws Exception { } @Test - void testUnicode() throws Exception { + void unicode() throws Exception { File tmpDir = getTestFile("src/test/resources/utf8"); TarArchiver archiver = getPosixTarArchiver(); File tarFile = getTestFile("target/output/tar-with-longFileName.tar"); @@ -278,7 +278,7 @@ void createArchive(final int directoryMode, final int fileModes[]) throws Except } @Test - void testCreateArchiveWithJiustASymlink() throws Exception { + void createArchiveWithJiustASymlink() throws Exception { TarArchiver archiver = getPosixTarArchiver(); archiver.setDirectoryMode(0500); @@ -394,17 +394,17 @@ TarFile newTarFile(File tarFile) { } @Test - void testUncompressedResourceCollection() throws Exception { + void uncompressedResourceCollection() throws Exception { testCreateResourceCollection(new TarHandler()); } @Test - void testGzipCompressedResourceCollection() throws Exception { + void gzipCompressedResourceCollection() throws Exception { testCreateResourceCollection(new GZipTarHandler()); } @Test - void testGzipFIleHandleLeak() throws Exception { + void gzipFIleHandleLeak() throws Exception { GZipTarHandler tarHandler = new GZipTarHandler(); final File tarFile = tarHandler.createTarFile(); final File tarFile2 = tarHandler.createTarfile2(tarFile); @@ -416,12 +416,12 @@ void testGzipFIleHandleLeak() throws Exception { } @Test - void testBzip2CompressedResourceCollection() throws Exception { + void bzip2CompressedResourceCollection() throws Exception { testCreateResourceCollection(new BZip2TarHandler()); } @Test - void testTarFileNotClosingInputStream() throws Exception { + void tarFileNotClosingInputStream() throws Exception { // Supposedly not closing the stream according to yjp. TarHandler tarHandler = new BZip2TarHandler(); final File fileName = tarHandler.createTarFile(); @@ -441,7 +441,7 @@ private void testCreateResourceCollection(TarHandler tarHandler) throws Exceptio } @Test - void testSymlinkArchivedFileSet() throws Exception { + void symlinkArchivedFileSet() 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 b93bea88..370a7178 100644 --- a/src/test/java/org/codehaus/plexus/archiver/tar/TarBZip2UnArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/tar/TarBZip2UnArchiverTest.java @@ -40,7 +40,7 @@ class TarBZip2UnArchiverTest extends TestSupport { @Test - void testExtract() throws Exception { + void extract() throws Exception { TarArchiver tarArchiver = (TarArchiver) lookup(Archiver.class, "tar"); tarArchiver.setLongfile(TarLongFileMode.posix); 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 64d28cc0..89956f44 100644 --- a/src/test/java/org/codehaus/plexus/archiver/tar/TarFileAttributesTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/tar/TarFileAttributesTest.java @@ -44,7 +44,7 @@ private void printTestHeader() { @Test @DisabledOnOs(OS.WINDOWS) - void testUseAttributesFromTarArchiveInputInTarArchiverOutput() throws Exception { + void useAttributesFromTarArchiveInputInTarArchiverOutput() throws Exception { printTestHeader(); File tempFile = @@ -96,7 +96,7 @@ void testUseAttributesFromTarArchiveInputInTarArchiverOutput() throws Exception @Test @DisabledOnOs(OS.WINDOWS) - void testUseDetectedFileAttributes() throws Exception { + void useDetectedFileAttributes() throws Exception { printTestHeader(); File tempFile = @@ -137,7 +137,7 @@ void testUseDetectedFileAttributes() throws Exception { @Test @DisabledOnOs(OS.WINDOWS) - void testOverrideDetectedFileAttributes() throws Exception { + void overrideDetectedFileAttributes() throws Exception { printTestHeader(); File tempFile = @@ -181,7 +181,7 @@ private TarArchiver getPosixCompliantTarArchiver() throws Exception { @Test @DisabledOnOs(OS.WINDOWS) - void testOverrideDetectedFileAttributesUsingFileMode() throws Exception { + void overrideDetectedFileAttributesUsingFileMode() 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 8a032db3..2532745f 100644 --- a/src/test/java/org/codehaus/plexus/archiver/tar/TarFileTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/tar/TarFileTest.java @@ -34,7 +34,7 @@ private interface TarFileCreator { * Test for the uncompressed tar file, {@link TarFile}. */ @Test - void testTarFile() throws Exception { + void tarFile() 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 - void testGZipTarFile() throws Exception { + void gZipTarFile() 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 - void testBZip2TarFile() throws Exception { + void bZip2TarFile() 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 2e19b188..aca2b2b0 100644 --- a/src/test/java/org/codehaus/plexus/archiver/tar/TarGZipUnArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/tar/TarGZipUnArchiverTest.java @@ -40,7 +40,7 @@ class TarGZipUnArchiverTest extends TestSupport { @Test - void testExtract() throws Exception { + void extract() throws Exception { TarArchiver tarArchiver = (TarArchiver) lookup(Archiver.class, "tar"); tarArchiver.setLongfile(TarLongFileMode.posix); 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 38e63867..e24a3c15 100644 --- a/src/test/java/org/codehaus/plexus/archiver/tar/TarRoundTripTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/tar/TarRoundTripTest.java @@ -18,7 +18,6 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -import java.io.IOException; import org.apache.commons.compress.archivers.tar.TarArchiveEntry; import org.apache.commons.compress.archivers.tar.TarArchiveInputStream; @@ -41,7 +40,7 @@ class TarRoundTripTest { * test round-tripping long (GNU) entries */ @Test - void testLongRoundTripping() throws IOException { + void longRoundTripping() throws Exception { 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 dee6c32a..bf78612d 100644 --- a/src/test/java/org/codehaus/plexus/archiver/tar/TarSnappyUnArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/tar/TarSnappyUnArchiverTest.java @@ -40,7 +40,7 @@ class TarSnappyUnArchiverTest extends TestSupport { @Test - void testExtract() throws Exception { + void extract() throws Exception { TarArchiver tarArchiver = (TarArchiver) lookup(Archiver.class, "tar"); tarArchiver.setLongfile(TarLongFileMode.posix); 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 31691ce4..2cf994a2 100644 --- a/src/test/java/org/codehaus/plexus/archiver/tar/TarUnArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/tar/TarUnArchiverTest.java @@ -46,12 +46,12 @@ private void assertFileExistance(String s, String file, boolean exists) { } @Test - void testExtractingADirectory() throws Exception { + void extractingADirectory() throws Exception { runUnarchiver(null, new boolean[] {true, true, true}); } @Test - void testSelectors() throws Exception { + void selectors() 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 6fda0741..fc0b1488 100644 --- a/src/test/java/org/codehaus/plexus/archiver/tar/TarXzUnArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/tar/TarXzUnArchiverTest.java @@ -36,7 +36,7 @@ class TarXzUnArchiverTest extends TestSupport { @Test - void testExtract() throws Exception { + void extract() throws Exception { TarArchiver tarArchiver = (TarArchiver) lookup(Archiver.class, "tar"); tarArchiver.setLongfile(TarLongFileMode.posix); 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 1e355f1b..2dc61891 100644 --- a/src/test/java/org/codehaus/plexus/archiver/tar/TarZstdUnArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/tar/TarZstdUnArchiverTest.java @@ -32,7 +32,7 @@ class TarZstdUnArchiverTest extends TestSupport { @Test - void testExtract() throws Exception { + void extract() throws Exception { TarArchiver tarArchiver = (TarArchiver) lookup(Archiver.class, "tar"); tarArchiver.setLongfile(TarLongFileMode.posix); 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 60305f15..d1149e42 100644 --- a/src/test/java/org/codehaus/plexus/archiver/util/ArchiveEntryUtilsTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/util/ArchiveEntryUtilsTest.java @@ -21,7 +21,7 @@ class ArchiveEntryUtilsTest { @Test @DisabledOnOs(OS.WINDOWS) - void testChmodForFileWithDollarPLXCOMP164() throws Exception { + void chmodForFileWithDollarPLXCOMP164() throws Exception { File temp = Files.createTempFile(tempDir, "A$A", "BB$").toFile(); ArchiveEntryUtils.chmod(temp, 0770); assert0770(temp); @@ -29,7 +29,7 @@ void testChmodForFileWithDollarPLXCOMP164() throws Exception { @Test @DisabledOnOs(OS.WINDOWS) - void testChmodWithJava7() throws Exception { + void chmodWithJava7() 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 702b0e18..c6a68432 100644 --- a/src/test/java/org/codehaus/plexus/archiver/util/DefaultFileSetTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/util/DefaultFileSetTest.java @@ -13,7 +13,7 @@ class DefaultFileSetTest { @Test - void testCreate() { + void create() { final String[] includes = {"zz", "yy"}; final String[] exc = {"xx1", "xx2"}; final boolean usingDefaultExcludes = true; 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 3b3f19cb..96468c15 100644 --- a/src/test/java/org/codehaus/plexus/archiver/util/FilePermissionUtilsTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/util/FilePermissionUtilsTest.java @@ -35,7 +35,7 @@ Logger getLogger() { } @Test - void testOnlyWritableOnlyUser() throws Exception { + void onlyWritableOnlyUser() throws Exception { FilePermission fp = FilePermissionUtils.getFilePermissionFromMode("200", getLogger()); assertTrue(fp.isWritable()); assertTrue(fp.isOwnerOnlyWritable()); @@ -45,7 +45,7 @@ void testOnlyWritableOnlyUser() throws Exception { } @Test - void testExecAndRead() { + void execAndRead() { FilePermission fp = FilePermissionUtils.getFilePermissionFromMode("500", getLogger()); assertFalse(fp.isWritable()); assertTrue(fp.isOwnerOnlyWritable()); @@ -55,7 +55,7 @@ void testExecAndRead() { } @Test - void testAllUser() { + void allUser() { FilePermission fp = FilePermissionUtils.getFilePermissionFromMode("700", getLogger()); assertTrue(fp.isWritable()); assertTrue(fp.isOwnerOnlyWritable()); @@ -65,7 +65,7 @@ void testAllUser() { } @Test - void testAllAllUser() { + void allAllUser() { 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 534ed060..932f5473 100644 --- a/src/test/java/org/codehaus/plexus/archiver/war/WarArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/war/WarArchiverTest.java @@ -21,7 +21,7 @@ class WarArchiverTest extends TestSupport { private final int expected = 8; @Test - void testReAddingPlatformSpecificEncoding() throws Exception { + void reAddingPlatformSpecificEncoding() throws Exception { WarArchiver archiver = (WarArchiver) lookup(Archiver.class, "war"); archiver.setDestFile(new File(getTargetRarFolder(), "test.war")); @@ -40,7 +40,7 @@ void testReAddingPlatformSpecificEncoding() throws Exception { } @Test - void testInfiniteRecursion() throws Exception { + void infiniteRecursion() 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 3a039dcc..6963cf4a 100644 --- a/src/test/java/org/codehaus/plexus/archiver/xz/XzArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/xz/XzArchiverTest.java @@ -32,6 +32,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotSame; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; @@ -42,7 +43,7 @@ class XzArchiverTest extends BasePlexusArchiverTest { @Test - void testCreateArchive() throws Exception { + void createArchive() throws Exception { ZipArchiver zipArchiver = (ZipArchiver) lookup(Archiver.class, "zip"); zipArchiver.addDirectory(getTestFile("src")); zipArchiver.setDestFile(getTestFile("target/output/archiveForxz.zip")); @@ -66,7 +67,7 @@ void testCreateArchive() throws Exception { } @Test - void testCreateEmptyArchive() throws Exception { + void createEmptyArchive() throws Exception { XZArchiver archiver = (XZArchiver) lookup(Archiver.class, "xz"); archiver.setDestFile(getTestFile("target/output/empty.xz")); try { @@ -78,7 +79,7 @@ void testCreateEmptyArchive() throws Exception { } @Test - void testCreateResourceCollection() throws Exception { + void createResourceCollection() 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 +115,7 @@ void testCreateResourceCollection() throws Exception { * @throws Exception */ @Test - void testXzIsForcedBehaviour() throws Exception { + void xzIsForcedBehaviour() throws Exception { XZArchiver xzArchiver = (XZArchiver) createArchiver("xz"); assertTrue(xzArchiver.isSupportingForced()); @@ -131,7 +132,7 @@ void testXzIsForcedBehaviour() throws Exception { final long firstRunTime = xzArchiver.getDestFile().lastModified(); - assertFalse(creationTime == firstRunTime); + assertNotSame(creationTime, firstRunTime); xzArchiver = (XZArchiver) createArchiver("xz"); diff --git a/src/test/java/org/codehaus/plexus/archiver/zip/OffloadingOutputStreamTest.java b/src/test/java/org/codehaus/plexus/archiver/zip/OffloadingOutputStreamTest.java index 9d9d8815..bb453463 100644 --- a/src/test/java/org/codehaus/plexus/archiver/zip/OffloadingOutputStreamTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/zip/OffloadingOutputStreamTest.java @@ -17,7 +17,6 @@ package org.codehaus.plexus.archiver.zip; import java.io.File; -import java.io.IOException; import java.nio.file.Files; import org.junit.jupiter.api.Test; @@ -27,7 +26,7 @@ class OffloadingOutputStreamTest { @Test - void temporaryFileShouldBeCreated() throws IOException { + void temporaryFileShouldBeCreated() throws Exception { File streamFile = null; try (OffloadingOutputStream stream = new OffloadingOutputStream(100, "test", "test")) { stream.write(new byte[256]); 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 ae018faa..21cd90b9 100644 --- a/src/test/java/org/codehaus/plexus/archiver/zip/PlexusArchiverZipFileResourceCollectionTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/zip/PlexusArchiverZipFileResourceCollectionTest.java @@ -1,7 +1,6 @@ package org.codehaus.plexus.archiver.zip; import java.io.File; -import java.io.IOException; import java.io.InputStream; import java.util.HashMap; import java.util.HashSet; @@ -20,7 +19,7 @@ class PlexusArchiverZipFileResourceCollectionTest extends TestSupport { @Test - void testFilesWithIllegalHtmlChars() throws Exception { + void filesWithIllegalHtmlChars() throws Exception { File testZip = new File(getBasedir(), "src/test/resources/archiveWithIllegalHtmlFileName.zip"); Set seen = new HashSet<>(); seen.add("AFileThatNeedsHtmlEsc%3F>"); @@ -39,7 +38,7 @@ void testFilesWithIllegalHtmlChars() throws Exception { } @Test - void testFileModes() throws IOException { + void fileModes() throws Exception { 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 be4892d9..237cbbdb 100644 --- a/src/test/java/org/codehaus/plexus/archiver/zip/PlexusIoZipFileResourceCollectionTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/zip/PlexusIoZipFileResourceCollectionTest.java @@ -21,12 +21,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertTrue; class PlexusIoZipFileResourceCollectionTest extends TestSupport { @Test - void testNamelessRootFolder() throws Exception { + void namelessRootFolder() throws Exception { // Use signature-verifying collection for JAR files that need URL support PlexusIoJarFileResourceCollectionWithSignatureVerification resourceCollection = new PlexusIoJarFileResourceCollectionWithSignatureVerification(); @@ -40,7 +41,7 @@ void testNamelessRootFolder() throws Exception { } @Test - void testDescriptionForError() throws Exception { + void descriptionForError() throws Exception { // Use signature-verifying collection for JAR files that need URL support PlexusIoJarFileResourceCollectionWithSignatureVerification resourceCollection = new PlexusIoJarFileResourceCollectionWithSignatureVerification(); @@ -53,7 +54,7 @@ void testDescriptionForError() throws Exception { } @Test - void testFilesWithIllegalHtmlChars() throws Exception { + void filesWithIllegalHtmlChars() throws Exception { File testZip = new File(getBasedir(), "src/test/resources/bogusManifest.zip"); PlexusIoZipFileResourceCollection prc = new PlexusIoZipFileResourceCollection(); prc.setFile(testZip); @@ -70,7 +71,7 @@ void testFilesWithIllegalHtmlChars() throws Exception { } @Test - void testFilesThatAreNotThere() throws Exception { + void filesThatAreNotThere() throws Exception { File testZip = new File(getBasedir(), "src/test/resources/archiveWithIllegalHtmlFileName.zip"); Set seen = new HashSet<>(); seen.add("AFileThatNeedsHtmlEsc%3F>"); @@ -89,7 +90,7 @@ void testFilesThatAreNotThere() throws Exception { } @Test - void testSymlinkEntries() throws Exception { + void symlinkEntries() throws Exception { File testZip = new File(getBasedir(), "src/test/resources/symlinks/symlinks.zip"); Map symLinks = new HashMap<>(); symLinks.put("symDir", "targetDir/"); @@ -106,7 +107,7 @@ void testSymlinkEntries() throws Exception { String symLinkTarget = symLinks.remove(next.getName()); if (symLinkTarget != null) { assertTrue(next.isSymbolicLink(), next.getName() + " must be symlink"); - assertTrue(next instanceof SymlinkDestinationSupplier); + assertInstanceOf(SymlinkDestinationSupplier.class, next); assertEquals(symLinkTarget, ((SymlinkDestinationSupplier) next).getSymlinkDestination()); } else { assertFalse(next.isSymbolicLink(), next.getName() + " must not be symlink"); @@ -117,7 +118,7 @@ void testSymlinkEntries() throws Exception { } @Test - void testUnarchiveUnicodePathExtra() throws Exception { + void unarchiveUnicodePathExtra() 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 68f8b2ad..74eb1943 100644 --- a/src/test/java/org/codehaus/plexus/archiver/zip/ZipArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/zip/ZipArchiverTest.java @@ -100,7 +100,7 @@ class ZipArchiverTest extends BasePlexusArchiverTest { private File tempDir; @Test - void testImplicitPermissions() throws IOException { + void implicitPermissions() throws Exception { File zipFile = getTestFile("target/output/zip-with-implicit-dirmode.zip"); ZipArchiver archiver = getZipArchiver(zipFile); @@ -130,7 +130,7 @@ void testImplicitPermissions() throws IOException { @Test @DisabledOnOs(OS.WINDOWS) - void testOveriddenPermissions() throws IOException { + void overiddenPermissions() throws Exception { File zipFile = getTestFile("target/output/zip-with-overriden-modes.zip"); ZipArchiver archiver = getZipArchiver(zipFile); @@ -150,7 +150,7 @@ void testOveriddenPermissions() throws IOException { @Test @DisabledOnOs(OS.WINDOWS) - void testCreateArchiveWithDetectedModes() throws Exception { + void createArchiveWithDetectedModes() throws Exception { String[] executablePaths = {"path/to/executable", "path/to/executable.bat"}; @@ -253,7 +253,7 @@ void testCreateArchiveWithDetectedModes() throws Exception { } @Test - void testCreateEmptyArchive() throws Exception { + void createEmptyArchive() throws Exception { ZipArchiver archiver = getZipArchiver(); archiver.setDestFile(getTestFile("target/output/empty.zip")); try { @@ -306,7 +306,7 @@ void testCreateArchive() throws Exception { } @Test - void testRecompressAddedZips() throws Exception { + void recompressAddedZips() throws Exception { // check that by default the zip archives are re-compressed final File zipFileRecompress = getTestFile("target/output/recompress-added-zips.zip"); @@ -360,7 +360,7 @@ void testRecompressAddedZips() throws Exception { } @Test - void testAddArchivedFileSet() throws Exception { + void addArchivedFileSet() throws Exception { File toBeAdded = new File("src/test/resources/test.zip"); DefaultArchivedFileSet sfd = DefaultArchivedFileSet.archivedFileSet(toBeAdded); File zipFIle = getTestFile("target/output/withZip.zip"); @@ -396,7 +396,7 @@ public InputStream transform(@Nonnull PlexusIoResource resource, @Nonnull InputS } @Test - void testCreateArchiveWithStreamTransformer() throws IOException { + void createArchiveWithStreamTransformer() throws Exception { InputStreamTransformer is = new InputStreamTransformer() { @Nonnull @@ -490,7 +490,7 @@ private void createArchive(ZipArchiver archiver) throws ArchiverException, IOExc @Test @DisabledOnOs(OS.WINDOWS) - void testSymlinkZip() throws Exception { + void symlinkZip() throws Exception { final File zipFile = getTestFile("target/output/pasymlinks.zip"); final ZipArchiver zipArchiver = getZipArchiver(zipFile); PlexusIoFileResourceCollection files = new PlexusIoFileResourceCollection(); @@ -512,7 +512,7 @@ void testSymlinkZip() throws Exception { @Test @DisabledOnOs(OS.WINDOWS) @SuppressWarnings("ResultOfMethodCallIgnored") - void testSymlinkFileSet() throws Exception { + void symlinkFileSet() throws Exception { final File zipFile = getTestFile("target/output/pasymlinks-fileset.zip"); final ZipArchiver zipArchiver = getZipArchiver(zipFile); final DefaultFileSet fs = new DefaultFileSet(); @@ -531,7 +531,7 @@ void testSymlinkFileSet() throws Exception { } @Test - void testSymlinkArchivedFileSet() throws Exception { + void symlinkArchivedFileSet() 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); @@ -548,7 +548,7 @@ void testSymlinkArchivedFileSet() throws Exception { * Verify that ZipArchiver rounds up the last modified time. */ @Test - void testLastModifiedTimeRounding() throws Exception { + void lastModifiedTimeRounding() 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)); @@ -577,7 +577,7 @@ void testLastModifiedTimeRounding() throws Exception { /* */ @Test - void testForced() throws Exception { + void forced() throws Exception { ZipArchiver archiver = newArchiver("archive2.zip"); assertTrue(archiver.isForced()); @@ -610,7 +610,7 @@ void testForced() throws Exception { // Used to investigate extrafields @Test - void testLookAtExtraZipFields_from_macos() throws IOException { + void lookAtExtraZipFieldsFromMacos() throws Exception { 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(); @@ -630,7 +630,7 @@ void testLookAtExtraZipFields_from_macos() throws IOException { // Used to investigate date roundtrip behaviour across zip versions @Test - void testZipStuff() throws IOException { + void zipStuff() throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ZipOutputStream zos = new ZipOutputStream(baos); // name the file inside the zip file @@ -671,7 +671,7 @@ void notestJustThatOne() throws Exception { } @Test - void testCreateResourceCollection() throws Exception { + void createResourceCollection() throws Exception { final File srcDir = new File("src"); final File zipFile = new File("target/output/src.zip"); ZipArchiver zipArchiver = getZipArchiver(zipFile); @@ -695,7 +695,7 @@ void testCreateResourceCollection() throws Exception { } @Test - void testZipNonConcurrentResourceCollection() throws Exception { + void zipNonConcurrentResourceCollection() 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 @@ -726,14 +726,14 @@ void testZipNonConcurrentResourceCollection() throws Exception { } @Test - void testDefaultUTF8() throws IOException { + void defaultUTF8() throws Exception { final ZipArchiver zipArchiver = getZipArchiver(new File("target/output/utf8-default.zip")); zipArchiver.addDirectory(new File("src/test/resources/miscUtf8")); zipArchiver.createArchive(); } @Test - void testDefaultUTF8withUTF8() throws IOException { + void defaultUTF8withUTF8() throws Exception { final ZipArchiver zipArchiver = getZipArchiver(new File("target/output/utf8-with_utf.zip")); zipArchiver.setEncoding("UTF-8"); zipArchiver.addDirectory(new File("src/test/resources/miscUtf8")); @@ -741,7 +741,7 @@ void testDefaultUTF8withUTF8() throws IOException { } @Test - void testForcedFileModes() throws IOException { + void forcedFileModes() throws Exception { File step1file = new File("target/output/forced-file-mode.zip"); { final ZipArchiver zipArchiver = getZipArchiver(step1file); @@ -801,7 +801,7 @@ void testForcedFileModes() throws IOException { } @Test - void testFixedEntryModificationTime() throws IOException { + void fixedEntryModificationTime() throws Exception { final long almostMinDosTime = toLocalTimeZone(315532802000L); final File zipFile = getTestFile("target/output/zip-with-fixed-entry-modification-times.zip"); @@ -821,7 +821,7 @@ void testFixedEntryModificationTime() throws IOException { @Test @DisabledOnOs(OS.WINDOWS) - void testNonExistingSymlink() throws Exception { + void nonExistingSymlink() throws Exception { File zipFile = new File("src/test/resources/symlinks/non_existing_symlink.zip"); ZipUnArchiver unArchiver = getZipUnArchiver(zipFile); String tmpdir = Files.createTempDirectory("tmpe_extract").toFile().getAbsolutePath(); @@ -864,7 +864,7 @@ private long toLocalTimeZone(long timestamp) { * as required by the ZIP file specification. */ @Test - void testGetFilesReturnsForwardSlashes() throws Exception { + void getFilesReturnsForwardSlashes() throws Exception { File zipFile = getTestFile("target/output/test-getfiles-slashes.zip"); ZipArchiver archiver = getZipArchiver(zipFile); 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 e86953d0..871745ce 100644 --- a/src/test/java/org/codehaus/plexus/archiver/zip/ZipUnArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/zip/ZipUnArchiverTest.java @@ -26,7 +26,7 @@ class ZipUnArchiverTest extends TestSupport { @Test - void testExtractingZipPreservesExecutableFlag() throws Exception { + void extractingZipPreservesExecutableFlag() throws Exception { String s = "target/zip-unarchiver-tests"; File testZip = new File(getBasedir(), "src/test/jars/test.zip"); @@ -48,7 +48,7 @@ void testExtractingZipPreservesExecutableFlag() throws Exception { } @Test - void testZeroFileModeInZip() throws Exception { + void zeroFileModeInZip() throws Exception { String s = "target/zip-unarchiver-filemode-tests"; File testZip = new File(getBasedir(), "src/test/resources/zeroFileMode/foobar.zip"); @@ -72,7 +72,7 @@ void testZeroFileModeInZip() throws Exception { } @Test - void testUnarchiveUtf8() throws Exception { + void unarchiveUtf8() throws Exception { File dest = new File("target/output/unzip/utf8"); dest.mkdirs(); @@ -89,7 +89,7 @@ void testUnarchiveUtf8() throws Exception { } @Test - void testUnarchiveUnicodePathExtra() throws Exception { + void unarchiveUnicodePathExtra() throws Exception { File dest = new File("target/output/unzip/unicodePathExtra"); dest.mkdirs(); for (String name : dest.list()) { @@ -108,7 +108,7 @@ void testUnarchiveUnicodePathExtra() throws Exception { } @Test - void testUnarchiveUnicodePathExtraSelector() throws Exception { + void unarchiveUnicodePathExtraSelector() 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 - void testExtractingADirectoryFromAJarFile() throws Exception { + void extractingADirectoryFromAJarFile() throws Exception { runUnarchiver("resources/artifactId", null, new boolean[] {true, true, false}); runUnarchiver("", null, new boolean[] {true, true, true}); } @Test - void testSelectors() throws Exception { + void selectors() 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 @@ void testSelectors() throws Exception { } @Test - void testExtractingZipWithEntryOutsideDestDirThrowsException() throws Exception { + void extractingZipWithEntryOutsideDestDirThrowsException() 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 @@ void testExtractingZipWithEntryOutsideDestDirThrowsException() throws Exception } @Test - void testZipOutputSizeException() throws Exception { + void zipOutputSizeException() 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 @@ void testZipOutputSizeException() throws Exception { } @Test - void testZipMaxOutputSizeEqualToExtractedFileSize() throws Exception { + void zipMaxOutputSizeEqualToExtractedFileSize() throws Exception { long extractedFileSize = 11L; String s = "target/zip-size-tests"; File testZip = new File(getBasedir(), "src/test/jars/test.zip"); @@ -265,7 +265,7 @@ private ZipArchiver getZipArchiver(File destFile) { } @Test - void testZipWithNegativeModificationTime() throws Exception { + void zipWithNegativeModificationTime() throws Exception { // Create a zip file with an entry that has -1 modification time File zipFile = new File("target/output/zip-with-negative-time.zip"); zipFile.getParentFile().mkdirs(); 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 8f3e643b..8f5b58b7 100644 --- a/src/test/java/org/codehaus/plexus/archiver/zstd/ZstdArchiverTest.java +++ b/src/test/java/org/codehaus/plexus/archiver/zstd/ZstdArchiverTest.java @@ -32,13 +32,14 @@ import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotSame; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; class ZstdArchiverTest extends BasePlexusArchiverTest { @Test - void testCreateArchive() throws Exception { + void createArchive() throws Exception { ZipArchiver zipArchiver = (ZipArchiver) lookup(Archiver.class, "zip"); zipArchiver.addDirectory(getTestFile("src")); zipArchiver.setDestFile(getTestFile("target/output/archiveForxz.zip")); @@ -62,7 +63,7 @@ void testCreateArchive() throws Exception { } @Test - void testCreateEmptyArchive() throws Exception { + void createEmptyArchive() throws Exception { ZstdArchiver archiver = (ZstdArchiver) lookup(Archiver.class, "zst"); archiver.setDestFile(getTestFile("target/output/empty.zst")); try { @@ -74,7 +75,7 @@ void testCreateEmptyArchive() throws Exception { } @Test - void testCreateResourceCollection() throws Exception { + void createResourceCollection() 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 +111,7 @@ void testCreateResourceCollection() throws Exception { * @throws Exception */ @Test - void testZstIsForcedBehaviour() throws Exception { + void zstIsForcedBehaviour() throws Exception { ZstdArchiver zstdArchiver = (ZstdArchiver) createArchiver("zst"); assertTrue(zstdArchiver.isSupportingForced()); @@ -127,7 +128,7 @@ void testZstIsForcedBehaviour() throws Exception { final long firstRunTime = zstdArchiver.getDestFile().lastModified(); - assertFalse(creationTime == firstRunTime); + assertNotSame(creationTime, firstRunTime); zstdArchiver = (ZstdArchiver) createArchiver("zst");