gnodet-bot commented on code in PR #577:
URL: 
https://github.com/apache/maven-resources-plugin/pull/577#discussion_r4594726959


##########
src/test/java/org/apache/maven/plugins/resources/stub/MavenProjectResourcesStub.java:
##########
@@ -66,7 +66,7 @@ public MavenProjectResourcesStub(String testRootDir) {
         directoryList = new ArrayList<>();
         dataMap = new HashMap<>();
 
-        if (!FileUtils.fileExists(testRootDir)) {
+        if (!new File(testRootDir).exists()) {

Review Comment:
   ⚠️ **Incomplete migration**: `fileExists()` replaced here, but 
`FileUtils.mkdir()` on the next line (and in `setupBuildEnvironment()` at lines 
141, 145, 153, 157) still uses plexus-utils — keeping the `import 
org.codehaus.plexus.util.FileUtils` alive.
   
   Replace each `FileUtils.mkdir(x)` with `new File(x).mkdirs()`. Note 
`mkdirs()` creates parent directories too, matching the plexus behavior.



##########
src/test/java/org/apache/maven/plugins/resources/ResourcesMojoTest.java:
##########
@@ -466,7 +466,7 @@ void testWindowsPathEscapingDisabled(ResourcesMojo mojo) 
throws Exception {
 
         String resourcesDir = project.getOutputDirectory();
 
-        assertTrue(FileUtils.fileExists(new File(resourcesDir, 
"path-listing.txt").getAbsolutePath()));
+        assertTrue(new File(new File(resourcesDir, 
"path-listing.txt").getAbsolutePath()).exists());

Review Comment:
   💡 **Unnecessary double-wrapping**: `new File(new File(resourcesDir, 
"path-listing.txt").getAbsolutePath()).exists()` constructs a File just to get 
its absolute path, then wraps it in another File. Use `new File(resourcesDir, 
"path-listing.txt").exists()` directly:
   
   ```suggestion
           assertTrue(new File(resourcesDir, "path-listing.txt").exists());
   ```



##########
src/test/java/org/apache/maven/plugins/resources/ResourcesMojoTest.java:
##########
@@ -493,7 +493,7 @@ void testWindowsPathEscapingEnabled(ResourcesMojo mojo) 
throws Exception {
 
         String resourcesDir = project.getOutputDirectory();
 
-        assertTrue(FileUtils.fileExists(new File(resourcesDir, 
"path-listing.txt").getAbsolutePath()));
+        assertTrue(new File(new File(resourcesDir, 
"path-listing.txt").getAbsolutePath()).exists());

Review Comment:
   💡 **Unnecessary double-wrapping** (same as line 469): simplify to `new 
File(resourcesDir, "path-listing.txt").exists()`.
   
   ```suggestion
           assertTrue(new File(resourcesDir, "path-listing.txt").exists());
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to