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-compiler-plugin.git

commit 346ab67f66965e61133b772b7dd66c4d0acfb8fb
Author: Sylwester Lachiewicz <[email protected]>
AuthorDate: Wed Nov 25 22:40:40 2026 +0000

    Modernize Groovy IT scripts
    
    See https://github.com/apache/maven-invoker-plugin/issues/811.
---
 src/it/MCOMPILER-192/verify.groovy        |  4 +---
 src/it/MCOMPILER-224/verify.groovy        | 30 ++++--------------------------
 src/it/MCOMPILER-525/verify.groovy        |  1 -
 src/it/default/verify.groovy              | 30 ++++--------------------------
 src/it/jdk16-annotation/verify.groovy     | 30 ++++--------------------------
 src/it/non-english-warnings/verify.groovy | 14 ++------------
 6 files changed, 15 insertions(+), 94 deletions(-)

diff --git a/src/it/MCOMPILER-192/verify.groovy 
b/src/it/MCOMPILER-192/verify.groovy
index 58fcac1d..2cb1a2ef 100644
--- a/src/it/MCOMPILER-192/verify.groovy
+++ b/src/it/MCOMPILER-192/verify.groovy
@@ -38,7 +38,5 @@ println "Jenkins: causedByExpected:${causedByExpected} 
twoFilesBeingCompiled:${t
 // We need to combine different identification to handle differences between 
OS's and JDK's.
 def finalResult = twoFilesBeingCompiled && checkResult && causedByExpected && 
compilationFailure1 && compilationFailure2
 
-if ( !finalResult ) { 
-  throw new RuntimeException( "log does not contain expected result to be 
failed but <startLog>" + content + "</startLog>")
-}
+assert finalResult : "log does not contain expected result to be failed but 
<startLog>" + content + "</startLog>"
 
diff --git a/src/it/MCOMPILER-224/verify.groovy 
b/src/it/MCOMPILER-224/verify.groovy
index 98cbd47d..ec521234 100644
--- a/src/it/MCOMPILER-224/verify.groovy
+++ b/src/it/MCOMPILER-224/verify.groovy
@@ -23,29 +23,7 @@ def otherExists =  log.contains("[INFO] OTHER Test message.")
 def warningExists = log.contains("[WARNING] WARNING Test message.")
 def mandatoryWarningExists = log.contains("[WARNING] MANDATORY_WARNING Test 
message.")
 
-def fail = false
-def messages = "The following assertions were violated:"
-if ( !noteExists ){
-    messages += "\nNOTE message not logged in INFO level!"
-    fail = true
-}
-
-if ( !otherExists ){
-    messages += "\nOTHER message not logged in INFO level!"
-    fail = true
-}
-
-if ( !warningExists ){
-    messages += "\nWARNING message not logged in WARNING level!"
-    fail = true
-}
-
-if ( !mandatoryWarningExists ){
-    messages += "\nMANDATORY_WARNING message not logged in WARNING level!"
-    fail = true
-}
-
-if ( fail ){
-    throw new RuntimeException( messages )
-}
-
+assert noteExists : "NOTE message not logged in INFO level!"
+assert otherExists : "OTHER message not logged in INFO level!"
+assert warningExists : "WARNING message not logged in WARNING level!"
+assert mandatoryWarningExists : "MANDATORY_WARNING message not logged in 
WARNING level!"
diff --git a/src/it/MCOMPILER-525/verify.groovy 
b/src/it/MCOMPILER-525/verify.groovy
index 0e97225d..05abebea 100644
--- a/src/it/MCOMPILER-525/verify.groovy
+++ b/src/it/MCOMPILER-525/verify.groovy
@@ -21,7 +21,6 @@
 import java.nio.file.*;
 import java.time.*;
 import java.time.temporal.*
-import java.util.*;
 
 File target = new File( basedir, "target" );
 assert target.isDirectory()
diff --git a/src/it/default/verify.groovy b/src/it/default/verify.groovy
index 402fb942..ae3cf6cb 100644
--- a/src/it/default/verify.groovy
+++ b/src/it/default/verify.groovy
@@ -17,30 +17,8 @@
  * under the License.
  */
 
-import java.io.*;
-import java.util.*;
-import java.util.regex.*;
+File mainClass = new File( basedir, "target/classes/foo/MyClass.class" );
+assert mainClass.isFile() : "Main class not existent: " + mainClass
 
-try
-{
-    File mainClass = new File( basedir, "target/classes/foo/MyClass.class" );
-    if ( !mainClass.isFile() )
-    {
-        System.out.println( "Main class not existent: " + mainClass );
-        return false;
-    }
-
-    File testClass = new File( basedir, "target/test-classes/foo/MyTest.class" 
);
-    if ( !testClass.isFile() )
-    {
-        System.out.println( "Test class not existent: " + testClass );
-        return false;
-    }
-}
-catch( Throwable t )
-{
-    t.printStackTrace();
-    return false;
-}
-
-return true;
+File testClass = new File( basedir, "target/test-classes/foo/MyTest.class" );
+assert testClass.isFile() : "Test class not existent: " + testClass
diff --git a/src/it/jdk16-annotation/verify.groovy 
b/src/it/jdk16-annotation/verify.groovy
index d5ef3083..90606683 100644
--- a/src/it/jdk16-annotation/verify.groovy
+++ b/src/it/jdk16-annotation/verify.groovy
@@ -17,30 +17,8 @@
  * under the License.
  */
 
-import java.io.*;
-import java.util.*;
-import java.util.regex.*;
+File res = new File( basedir, "target/test-classes/META-INF/one" );
+assert res.isFile() : "generated resource not existent: " + res
 
-try
-{
-    File res = new File( basedir, "target/test-classes/META-INF/one" );
-    if ( !res.isFile() )
-    {
-        System.out.println( "generated resource not existent: " + res );
-        return false;
-    }
-    File java = new File( basedir, 
"target/generated-test-sources/test-annotations/org/Milos.java" );
-    if ( !java.isFile() )
-    {
-        System.out.println( "generated java file not existent: " + java );
-        return false;
-    }
-
-}
-catch( Throwable t )
-{
-    t.printStackTrace();
-    return false;
-}
-
-return true;
+File java = new File( basedir, 
"target/generated-test-sources/test-annotations/org/Milos.java" );
+assert java.isFile() : "generated java file not existent: " + java
diff --git a/src/it/non-english-warnings/verify.groovy 
b/src/it/non-english-warnings/verify.groovy
index db162700..a10c87cc 100644
--- a/src/it/non-english-warnings/verify.groovy
+++ b/src/it/non-english-warnings/verify.groovy
@@ -18,18 +18,8 @@
  */
 package foo;
 
-import java.io.*;
-import java.util.*;
-import java.util.regex.*;
-
 File mainClass = new File( basedir, "target/classes/foo/MyClass.class" );
-if ( !mainClass.isFile() )
-{
-    throw new FileNotFoundException( "Main class not existent: " + mainClass );
-}
+assert mainClass.isFile() : "Main class not existent: " + mainClass
 
 File testClass = new File( basedir, "target/test-classes/foo/MyTest.class" );
-if ( !testClass.isFile() )
-{
-    throw new FileNotFoundException( "Test class not existent: " + testClass );
-}
+assert testClass.isFile() : "Test class not existent: " + testClass

Reply via email to