This is an automated email from the ASF dual-hosted git repository.
elharo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-clean-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new 155e5dc Clean up assertions in CleanMojoTest (#61)
155e5dc is described below
commit 155e5dc678ef4dde961582952a5d5dc44a1d6caf
Author: Elliotte Rusty Harold <[email protected]>
AuthorDate: Wed Nov 27 19:35:43 2024 +0000
Clean up assertions in CleanMojoTest (#61)
* Clean up assertions
---
.../java/org/apache/maven/plugins/clean/CleanMojoTest.java | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/src/test/java/org/apache/maven/plugins/clean/CleanMojoTest.java
b/src/test/java/org/apache/maven/plugins/clean/CleanMojoTest.java
index 5a5d0d4..882a672 100644
--- a/src/test/java/org/apache/maven/plugins/clean/CleanMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/clean/CleanMojoTest.java
@@ -45,14 +45,12 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assertions.fail;
/**
* Test the clean mojo.
*/
@MojoTest
public class CleanMojoTest {
- private static final String LOCAL_REPO = "target/local-repo/";
/**
* Tests the simple removal of directories
@@ -172,10 +170,7 @@ public class CleanMojoTest {
File f = new File(getBasedir(), "buildDirectory/file.txt");
try (FileChannel channel = new RandomAccessFile(f, "rw").getChannel();
FileLock ignored = channel.lock()) {
- mojo.execute();
- fail("Should fail to delete a file that is locked");
- } catch (MojoException expected) {
- assertTrue(true);
+ assertThrows(MojoException.class, () -> mojo.execute());
}
}
@@ -199,9 +194,6 @@ public class CleanMojoTest {
try (FileChannel channel = new RandomAccessFile(f, "rw").getChannel();
FileLock ignored = channel.lock()) {
mojo.execute();
- assertTrue(true);
- } catch (MojoException expected) {
- fail("Should display a warning when deleting a file that is
locked");
}
}