Skip to content

Commit

Permalink
Remove public modifier from JUnit 5 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
slawekjaranowski committed Jul 18, 2023
1 parent 481a9c2 commit 8b8d277
Show file tree
Hide file tree
Showing 40 changed files with 225 additions and 228 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@ bin
*.iml
*.iws
.idea



.DS_Store
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

import static org.junit.jupiter.api.Assertions.assertEquals;

public class AbstractArchiverTest {
class AbstractArchiverTest {

private AbstractArchiver archiver;

@BeforeEach
public void setUp() throws Exception {
void setUp() throws Exception {
this.archiver = new AbstractArchiver() {

@Override
Expand All @@ -34,7 +34,7 @@ protected void close() throws IOException {
}

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

Expand All @@ -43,13 +43,13 @@ public void testModesAndOverridesAreUnsetByDefault() {
}

@Test
public void testWhenUnsetModeUsesDefault() {
void testWhenUnsetModeUsesDefault() {
assertEquals(Archiver.DEFAULT_FILE_MODE, archiver.getFileMode());
assertEquals(Archiver.DEFAULT_DIR_MODE, archiver.getDirectoryMode());
}

@Test
public void testSetModeIsUsedWithFlagsForType() {
void testSetModeIsUsedWithFlagsForType() {
archiver.setFileMode(0400);
assertEquals(0100400, archiver.getFileMode());

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

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

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

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

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

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

@Test
public void testSetDestFileInTheWorkingDir() {
void testSetDestFileInTheWorkingDir() {
archiver.setDestFile(new File("archive"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@
*
* @author <a href="mailto:karg@quipsy.de">Markus KARG</a>
*/
public class AbstractUnArchiverTest {
class AbstractUnArchiverTest {
private AbstractUnArchiver abstractUnArchiver;

@BeforeEach
public void setUp() {
void setUp() {
this.abstractUnArchiver = new AbstractUnArchiver() {
@Override
protected void execute(final String path, final File outputDirectory) throws ArchiverException {
Expand All @@ -55,13 +55,12 @@ protected void execute() throws ArchiverException {
}

@AfterEach
public void tearDown() {
void tearDown() {
this.abstractUnArchiver = null;
}

@Test
public void shouldThrowExceptionBecauseRewrittenPathIsOutOfDirectory(@TempDir File targetFolder)
throws ArchiverException {
void shouldThrowExceptionBecauseRewrittenPathIsOutOfDirectory(@TempDir File targetFolder) throws ArchiverException {
// given

// The prefix includes the target directory name to make sure we catch cases when the paths
Expand All @@ -82,7 +81,7 @@ public void shouldThrowExceptionBecauseRewrittenPathIsOutOfDirectory(@TempDir Fi
}

@Test
public void shouldExtractWhenFileOnDiskDoesNotExist(@TempDir File temporaryFolder) throws IOException {
void shouldExtractWhenFileOnDiskDoesNotExist(@TempDir File temporaryFolder) throws IOException {
// given
File file = new File(temporaryFolder, "whatever.txt"); // does not create the file!
String entryname = file.getName();
Expand All @@ -96,7 +95,7 @@ public void shouldExtractWhenFileOnDiskDoesNotExist(@TempDir File temporaryFolde
}

@Test
public void shouldExtractWhenFileOnDiskIsNewerThanEntryInArchive(@TempDir File temporaryFolder) throws IOException {
void shouldExtractWhenFileOnDiskIsNewerThanEntryInArchive(@TempDir File temporaryFolder) throws IOException {
// given
File file = new File(temporaryFolder, "whatever.txt");
file.createNewFile();
Expand All @@ -112,8 +111,8 @@ public void shouldExtractWhenFileOnDiskIsNewerThanEntryInArchive(@TempDir File t
}

@Test
public void shouldExtractWhenFileOnDiskIsNewerThanEntryInArchive_andWarnAboutDifferentCasing(
@TempDir File temporaryFolder) throws IOException {
void shouldExtractWhenFileOnDiskIsNewerThanEntryInArchive_andWarnAboutDifferentCasing(@TempDir File temporaryFolder)
throws IOException {
// given
File file = new File(temporaryFolder, "whatever.txt");
file.createNewFile();
Expand All @@ -127,7 +126,7 @@ public void shouldExtractWhenFileOnDiskIsNewerThanEntryInArchive_andWarnAboutDif
}

@Test
public void shouldExtractWhenEntryInArchiveIsNewerThanFileOnDisk(@TempDir File temporaryFolder) throws IOException {
void shouldExtractWhenEntryInArchiveIsNewerThanFileOnDisk(@TempDir File temporaryFolder) throws IOException {
// given
File file = new File(temporaryFolder, "whatever.txt");
file.createNewFile();
Expand All @@ -143,8 +142,8 @@ public void shouldExtractWhenEntryInArchiveIsNewerThanFileOnDisk(@TempDir File t
}

@Test
public void shouldExtractWhenEntryInArchiveIsNewerThanFileOnDiskAndWarnAboutDifferentCasing(
@TempDir File temporaryFolder) throws IOException {
void shouldExtractWhenEntryInArchiveIsNewerThanFileOnDiskAndWarnAboutDifferentCasing(@TempDir File temporaryFolder)
throws IOException {
// given
File file = new File(temporaryFolder, "whatever.txt");
file.createNewFile();
Expand All @@ -161,7 +160,7 @@ public void shouldExtractWhenEntryInArchiveIsNewerThanFileOnDiskAndWarnAboutDiff
}

@Test
public void shouldNotWarnAboutDifferentCasingForDirectoryEntries(@TempDir File temporaryFolder) throws IOException {
void shouldNotWarnAboutDifferentCasingForDirectoryEntries(@TempDir File temporaryFolder) throws IOException {
// given
File file = new File(temporaryFolder, "whatever.txt");
file.createNewFile();
Expand All @@ -176,7 +175,7 @@ public void shouldNotWarnAboutDifferentCasingForDirectoryEntries(@TempDir File t
}

@Test
public void shouldExtractWhenCasingDifferOnlyInEntryNamePath(@TempDir File temporaryFolder) throws IOException {
void shouldExtractWhenCasingDifferOnlyInEntryNamePath(@TempDir File temporaryFolder) throws IOException {
// given
String entryName = "directory/whatever.txt";
File file = new File(temporaryFolder, entryName); // does not create the file!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
/**
* @author Jason van Zyl
*/
public class DotDirectiveArchiveFinalizerTest extends TestSupport {
class DotDirectiveArchiveFinalizerTest extends TestSupport {

@Test
public void testDotDirectiveArchiveFinalizer() throws Exception {
void testDotDirectiveArchiveFinalizer() throws Exception {
DotDirectiveArchiveFinalizer ddaf =
new DotDirectiveArchiveFinalizer(new File(getBasedir(), "src/test/dotfiles"));

Expand All @@ -40,7 +40,7 @@ public void testDotDirectiveArchiveFinalizer() throws Exception {
}

@Test
public void testDefaultDotDirectiveBehaviour() throws Exception {
void testDefaultDotDirectiveBehaviour() throws Exception {
File dotFileDirectory = new File(getBasedir(), "src/test/dotfiles");

JarArchiver archiver = new JarArchiver();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
/**
* @author Erik Engstrom
*/
public class DuplicateFilesTest extends TestSupport {
class DuplicateFilesTest extends TestSupport {

private static final File file1 = getTestFile("src/test/resources/group-writable/foo.txt");

Expand All @@ -29,7 +29,7 @@ public class DuplicateFilesTest extends TestSupport {
private static final File destination = getTestFile("target/output/duplicateFiles");

@Test
public void testZipArchiver() throws Exception {
void testZipArchiver() throws Exception {
Archiver archiver = lookup(Archiver.class, "zip");
archiver.setDuplicateBehavior(Archiver.DUPLICATES_SKIP);

Expand All @@ -53,14 +53,14 @@ public void testZipArchiver() throws Exception {
}

@Test
public void testDirArchiver() throws Exception {
void testDirArchiver() throws Exception {
Archiver archiver = lookup(Archiver.class, "dir");
createArchive(archiver, "dir");
testFinalFile("target/output/duplicateFiles.dir/duplicateFiles/foo.txt");
}

@Test
public void testTarArchiver() throws Exception {
void testTarArchiver() throws Exception {
TarArchiver archiver = (TarArchiver) lookup(Archiver.class, "tar");
archiver.setLongfile(TarLongFileMode.posix);
archiver.setDuplicateBehavior(Archiver.DUPLICATES_SKIP);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,21 @@
/**
* @author Daniel Krisher
*/
public class EmptyDirectoryTest extends TestSupport {
class EmptyDirectoryTest extends TestSupport {

@Test
public void testZipArchiver() throws Exception {
void testZipArchiver() throws Exception {
testEmptyDirectory("zip", lookup(Archiver.class, "zip"));
}

@Test
public void testJarArchiver() throws Exception {
void testJarArchiver() throws Exception {
// No JAR UnArchiver implementation :(
// testEmptyDirectory( "jar" );
}

@Test
public void testTarArchiver() throws Exception {
void testTarArchiver() throws Exception {
final TarArchiver tar = (TarArchiver) lookup(Archiver.class, "tar");
tar.setLongfile(TarLongFileMode.posix);
testEmptyDirectory("tar", tar);
Expand Down
14 changes: 7 additions & 7 deletions src/test/java/org/codehaus/plexus/archiver/SymlinkTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,34 @@
/**
* @author Kristian Rosenvold
*/
public class SymlinkTest extends TestSupport {
class SymlinkTest extends TestSupport {

@Test
@DisabledOnOs(OS.WINDOWS)
public void testSymlinkDir() throws IOException {
void testSymlinkDir() throws IOException {
File dummyContent = getTestFile("src/test/resources/symlinks/src/symDir");
assertTrue(dummyContent.isDirectory());
assertTrue(Files.isSymbolicLink(dummyContent.toPath()));
}

@Test
@DisabledOnOs(OS.WINDOWS)
public void testSymlinkDirWithSlash() throws IOException {
void testSymlinkDirWithSlash() throws IOException {
File dummyContent = getTestFile("src/test/resources/symlinks/src/symDir/");
assertTrue(dummyContent.isDirectory());
assertTrue(Files.isSymbolicLink(dummyContent.toPath()));
}

@Test
@DisabledOnOs(OS.WINDOWS)
public void testSymlinkFile() {
void testSymlinkFile() {
File dummyContent = getTestFile("src/test/resources/symlinks/src/symR");
assertFalse(dummyContent.isDirectory());
assertTrue(Files.isSymbolicLink(dummyContent.toPath()));
}

@Test
public void testSymlinkTar() throws Exception {
void testSymlinkTar() throws Exception {
TarArchiver archiver = (TarArchiver) lookup(Archiver.class, "tar");
archiver.setLongfile(TarLongFileMode.posix);

Expand All @@ -65,7 +65,7 @@ public void testSymlinkTar() throws Exception {
}

@Test
public void testSymlinkZip() throws Exception {
void testSymlinkZip() throws Exception {
ZipArchiver archiver = (ZipArchiver) lookup(Archiver.class, "zip");

File dummyContent = getTestFile("src/test/resources/symlinks/src");
Expand All @@ -85,7 +85,7 @@ public void testSymlinkZip() throws Exception {

@Test
@DisabledOnOs(OS.WINDOWS)
public void testSymlinkDirArchiver() throws Exception {
void testSymlinkDirArchiver() throws Exception {
DirectoryArchiver archiver = (DirectoryArchiver) lookup(Archiver.class, "dir");

File dummyContent = getTestFile("src/test/resources/symlinks/src");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@
/**
* @author Emmanuel Venisse
*/
public class BZip2ArchiverTest extends BasePlexusArchiverTest {
class BZip2ArchiverTest extends BasePlexusArchiverTest {

@Test
public void testCreateArchive() throws Exception {
void testCreateArchive() throws Exception {
ZipArchiver zipArchiver = (ZipArchiver) lookup(Archiver.class, "zip");
zipArchiver.addDirectory(getTestFile("src"));
zipArchiver.setDestFile(getTestFile("target/output/archiveForbz2.zip"));
Expand All @@ -63,7 +63,7 @@ public void testCreateArchive() throws Exception {
}

@Test
public void testCreateEmptyArchive() throws Exception {
void testCreateEmptyArchive() throws Exception {
BZip2Archiver archiver = (BZip2Archiver) lookup(Archiver.class, "bzip2");
archiver.setDestFile(getTestFile("target/output/empty.bz2"));
try {
Expand All @@ -75,7 +75,7 @@ public void testCreateEmptyArchive() throws Exception {
}

@Test
public void testCreateResourceCollection() throws Exception {
void testCreateResourceCollection() throws Exception {
final File pomFile = new File("pom.xml");
final File bz2File = new File("target/output/pom.xml.bz2");
BZip2Archiver bzip2Archiver = (BZip2Archiver) lookup(Archiver.class, "bzip2");
Expand Down Expand Up @@ -111,7 +111,7 @@ public void testCreateResourceCollection() throws Exception {
* @throws Exception
*/
@Test
public void testBz2IsForcedBehaviour() throws Exception {
void testBz2IsForcedBehaviour() throws Exception {
BZip2Archiver bZip2Archiver = (BZip2Archiver) createArchiver("bzip2");

assertTrue(bZip2Archiver.isSupportingForced());
Expand Down

0 comments on commit 8b8d277

Please sign in to comment.