Skip to content

Commit 9c12070

Browse files
JUnit Jupiter best practices (#279)
Co-authored-by: Moderne <[email protected]>
1 parent 25c53b6 commit 9c12070

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/test/java/org/apache/maven/plugins/clean/CleanMojoTest.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
* Test the clean mojo.
5252
*/
5353
@MojoTest
54-
public class CleanMojoTest {
54+
class CleanMojoTest {
5555

5656
private final Log log = mock(Log.class);
5757

@@ -63,7 +63,7 @@ public class CleanMojoTest {
6363
@Test
6464
@Basedir("${basedir}/target/test-classes/unit/basic-clean-test")
6565
@InjectMojo(goal = "clean")
66-
public void testBasicClean(CleanMojo mojo) throws Exception {
66+
void basicClean(CleanMojo mojo) throws Exception {
6767
mojo.execute();
6868

6969
assertFalse(checkExists(getBasedir() + "/buildDirectory"), "Directory exists");
@@ -79,7 +79,7 @@ public void testBasicClean(CleanMojo mojo) throws Exception {
7979
@Test
8080
@Basedir("${basedir}/target/test-classes/unit/nested-clean-test")
8181
@InjectMojo(goal = "clean")
82-
public void testCleanNestedStructure(CleanMojo mojo) throws Exception {
82+
void cleanNestedStructure(CleanMojo mojo) throws Exception {
8383
mojo.execute();
8484

8585
assertFalse(checkExists(getBasedir() + "/target"));
@@ -96,7 +96,7 @@ public void testCleanNestedStructure(CleanMojo mojo) throws Exception {
9696
@Test
9797
@Basedir("${basedir}/target/test-classes/unit/empty-clean-test")
9898
@InjectMojo(goal = "clean")
99-
public void testCleanEmptyDirectories(CleanMojo mojo) throws Exception {
99+
void cleanEmptyDirectories(CleanMojo mojo) throws Exception {
100100
mojo.execute();
101101

102102
assertTrue(checkExists(getBasedir() + "/testDirectoryStructure"));
@@ -113,7 +113,7 @@ public void testCleanEmptyDirectories(CleanMojo mojo) throws Exception {
113113
@Test
114114
@Basedir("${basedir}/target/test-classes/unit/fileset-clean-test")
115115
@InjectMojo(goal = "clean")
116-
public void testFilesetsClean(CleanMojo mojo) throws Exception {
116+
void filesetsClean(CleanMojo mojo) throws Exception {
117117
mojo.execute();
118118

119119
// fileset 1
@@ -139,7 +139,7 @@ public void testFilesetsClean(CleanMojo mojo) throws Exception {
139139
@Test
140140
@Basedir("${basedir}/target/test-classes/unit/invalid-directory-test")
141141
@InjectMojo(goal = "clean")
142-
public void testCleanInvalidDirectory(CleanMojo mojo) throws Exception {
142+
void cleanInvalidDirectory(CleanMojo mojo) throws Exception {
143143
assertThrows(MojoException.class, mojo::execute, "Should fail to delete a file treated as a directory");
144144
}
145145

@@ -151,7 +151,7 @@ public void testCleanInvalidDirectory(CleanMojo mojo) throws Exception {
151151
@Test
152152
@Basedir("${basedir}/target/test-classes/unit/missing-directory-test")
153153
@InjectMojo(goal = "clean")
154-
public void testMissingDirectory(CleanMojo mojo) throws Exception {
154+
void missingDirectory(CleanMojo mojo) throws Exception {
155155
mojo.execute();
156156

157157
assertFalse(checkExists(getBasedir() + "/does-not-exist"));
@@ -169,7 +169,7 @@ public void testMissingDirectory(CleanMojo mojo) throws Exception {
169169
@EnabledOnOs(OS.WINDOWS)
170170
@Basedir("${basedir}/target/test-classes/unit/locked-file-test")
171171
@InjectMojo(goal = "clean")
172-
public void testCleanLockedFile(CleanMojo mojo) throws Exception {
172+
void cleanLockedFile(CleanMojo mojo) throws Exception {
173173
File f = new File(getBasedir(), "buildDirectory/file.txt");
174174
try (FileChannel channel = new RandomAccessFile(f, "rw").getChannel();
175175
FileLock ignored = channel.lock()) {
@@ -189,7 +189,7 @@ public void testCleanLockedFile(CleanMojo mojo) throws Exception {
189189
@EnabledOnOs(OS.WINDOWS)
190190
@Basedir("${basedir}/target/test-classes/unit/locked-file-test")
191191
@InjectMojo(goal = "clean")
192-
public void testCleanLockedFileWithNoError(CleanMojo mojo) throws Exception {
192+
void cleanLockedFileWithNoError(CleanMojo mojo) throws Exception {
193193
setVariableValueToObject(mojo, "failOnError", Boolean.FALSE);
194194
assertNotNull(mojo);
195195

@@ -206,7 +206,7 @@ public void testCleanLockedFileWithNoError(CleanMojo mojo) throws Exception {
206206
*/
207207
@Test
208208
@EnabledOnOs(OS.WINDOWS)
209-
public void testFollowLinksWithWindowsJunction() throws Exception {
209+
void followLinksWithWindowsJunction() throws Exception {
210210
testSymlink((link, target) -> {
211211
Process process = new ProcessBuilder()
212212
.directory(link.getParent().toFile())
@@ -228,7 +228,7 @@ public void testFollowLinksWithWindowsJunction() throws Exception {
228228
*/
229229
@Test
230230
@DisabledOnOs(OS.WINDOWS)
231-
public void testFollowLinksWithSymLinkOnPosix() throws Exception {
231+
void followLinksWithSymLinkOnPosix() throws Exception {
232232
testSymlink((link, target) -> {
233233
try {
234234
Files.createSymbolicLink(link, target);

0 commit comments

Comments
 (0)