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

slachiewicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-pmd-plugin.git

commit 0b995d33570c8651fafb5e9be4f5b9e4e9aa97d1
Author: Sylwester Lachiewicz <[email protected]>
AuthorDate: Wed Nov 25 23:01:00 2026 +0000

    Modernize Groovy IT scripts
    
    See https://github.com/apache/maven-invoker-plugin/issues/811.
---
 src/it/multi-module/verify.groovy | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/src/it/multi-module/verify.groovy 
b/src/it/multi-module/verify.groovy
index 6bce67d..c7cc52a 100644
--- a/src/it/multi-module/verify.groovy
+++ b/src/it/multi-module/verify.groovy
@@ -19,11 +19,6 @@
 
 import groovy.transform.Field
 
-import org.codehaus.plexus.util.FileUtils;
-
-import java.io.*;
-import java.util.*;
-
 String[] modules = [ "mod-1", "mod-2", "mod-3" ] as String[];
 @Field String[] paths = [
     "target/site/pmd.html",
@@ -62,17 +57,11 @@ for ( String path : paths )
 // check PMD rulesets target copy
 File rule = new File( basedir, "mod-1/target/pmd/rulesets/002-latin-1.xml" );
 String nonascii = "-CHARS: 
\u00C4\u00D6\u00DC\u00E4\u00F6\u00FC\u00DF\u00BC\u00BD\u00BE\u00A4";
-String content = FileUtils.fileRead( rule, "ISO-8859-1" );
-if ( content.indexOf( nonascii ) < 0 )
-{
-    throw new IOException( "non-ascii content corrupted in Latin1." );
-}
+String content = rule.getText( "ISO-8859-1" );
+assert content.contains( nonascii ) : "non-ascii content corrupted in Latin1."
 rule = new File( basedir, "mod-1/target/pmd/rulesets/001-utf-8.xml" );
-content = FileUtils.fileRead( rule, "UTF-8" );
-if ( content.indexOf( nonascii ) < 0 )
-{
-    throw new IOException( "non-ascii content corrupted in UTF-8." );
-}
+content = rule.getText( "UTF-8" );
+assert content.contains( nonascii ) : "non-ascii content corrupted in UTF-8."
 
 // check xml files encoding
 void checkEncoding( String module, String encoding )
@@ -84,7 +73,7 @@ void checkEncoding( String module, String encoding )
             continue;
         }
         File file = new File( basedir, module + '/' + path );
-        String content = FileUtils.fileRead( file, encoding );
+        String content = file.getText( encoding );
         if ( !content.startsWith( "<?xml version=\"1.0\" encoding=\"" + 
encoding + "\"?>" ) )
         {
             throw new IOException( "wrong XML encoding declaration for " + 
file );

Reply via email to