Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected void close() throws IOException {
}

@Test
void testModesAndOverridesAreUnsetByDefault() {
void modesAndOverridesAreUnsetByDefault() {
assertEquals(-1, archiver.getDefaultFileMode());
assertEquals(-1, archiver.getOverrideFileMode());

Expand All @@ -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());

Expand All @@ -58,7 +58,7 @@ void testSetModeIsUsedWithFlagsForType() {
}

@Test
void testSetDefaultIncludesFlagsForType() {
void setDefaultIncludesFlagsForType() {
archiver.setDefaultFileMode(0400);
assertEquals(0100400, archiver.getDefaultFileMode());

Expand All @@ -67,7 +67,7 @@ void testSetDefaultIncludesFlagsForType() {
}

@Test
void testDefaultIsUsedWhenModeIsUnset() {
void defaultIsUsedWhenModeIsUnset() {
archiver.setDefaultFileMode(0400);
assertEquals(0100400, archiver.getFileMode());

Expand All @@ -76,7 +76,7 @@ void testDefaultIsUsedWhenModeIsUnset() {
}

@Test
void testOverridesCanBeReset() {
void overridesCanBeReset() {
archiver.setFileMode(0400);
archiver.setFileMode(-1);
assertEquals(-1, archiver.getOverrideFileMode());
Expand All @@ -87,7 +87,7 @@ void testOverridesCanBeReset() {
}

@Test
void testSetDestFileInTheWorkingDir() {
void setDestFileInTheWorkingDir() {
archiver.setDestFile(new File("archive"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"));

Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
13 changes: 6 additions & 7 deletions src/test/java/org/codehaus/plexus/archiver/SymlinkTest.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -24,30 +23,30 @@ 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()));
}

@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()));
}

@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);

Expand All @@ -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");
Expand All @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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"));
Expand All @@ -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 {
Expand All @@ -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");
Expand Down Expand Up @@ -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());
Expand All @@ -128,7 +128,7 @@ void testBz2IsForcedBehaviour() throws Exception {

final long firstRunTime = bZip2Archiver.getDestFile().lastModified();

assertFalse(creationTime == firstRunTime);
assertNotSame(creationTime, firstRunTime);

bZip2Archiver = (BZip2Archiver) createArchiver("bzip2");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand All @@ -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 {
Expand All @@ -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");
Expand Down Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand All @@ -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();

Expand Down
Loading