You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by el...@apache.org on 2025/10/23 12:03:16 UTC

(maven-war-plugin) 01/01: File creation is a prerequisite for the test, not itself a test

This is an automated email from the ASF dual-hosted git repository.

elharo pushed a commit to branch uti
in repository https://gitbox.apache.org/repos/asf/maven-war-plugin.git

commit 5779099d4ef406f4c5b76eb85c01b4dd76ce192e
Author: Elliotte Rusty Harold <el...@ibiblio.org>
AuthorDate: Thu Oct 23 08:03:03 2025 -0400

    File creation is a prerequisite for the test, not itself a test
---
 .../java/org/apache/maven/plugins/war/AbstractWarMojoTest.java | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/test/java/org/apache/maven/plugins/war/AbstractWarMojoTest.java b/src/test/java/org/apache/maven/plugins/war/AbstractWarMojoTest.java
index cbbdf57..2f9543d 100644
--- a/src/test/java/org/apache/maven/plugins/war/AbstractWarMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/war/AbstractWarMojoTest.java
@@ -18,8 +18,12 @@
  */
 package org.apache.maven.plugins.war;
 
+import static org.junit.Assume.assumeTrue;
+
 import java.io.File;
 import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
 import java.util.Date;
 import java.util.List;
 
@@ -34,7 +38,6 @@ import org.apache.maven.shared.filtering.MavenFileFilter;
 import org.codehaus.plexus.PlexusContainer;
 import org.codehaus.plexus.archiver.ArchiverException;
 import org.codehaus.plexus.archiver.jar.JarArchiver;
-import org.codehaus.plexus.util.FileUtils;
 import org.eclipse.aether.RepositorySystemSession;
 
 public abstract class AbstractWarMojoTest extends AbstractMojoTestCase {
@@ -171,9 +174,10 @@ public abstract class AbstractWarMojoTest extends AbstractMojoTestCase {
 
     protected void createFile(File testFile, String body) throws Exception {
         createDir(testFile.getParentFile());
-        FileUtils.fileWrite(testFile.toString(), body);
+        byte[] data = body.getBytes(StandardCharsets.UTF_8);
+        Files.write(testFile.toPath(), data);
 
-        assertTrue("could not create file: " + testFile, testFile.exists());
+        assumeTrue("could not create file: " + testFile, testFile.exists());
     }
 
     protected void createFile(File testFile) throws Exception {