Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove public modifier from JUnit 5 tests #294

Merged
merged 1 commit into from Jul 18, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 1 addition & 3 deletions .gitignore
Expand Up @@ -7,6 +7,4 @@ bin
*.iml
*.iws
.idea



.DS_Store
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"));
}
}
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
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
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
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
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
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