groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject [groovy] 02/02: add an additional test method
Date Wed, 17 Apr 2019 01:05:56 GMT
This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 8fc0e23cfe48f379a3a1ab59a9433ab3973ce384
Author: Paul King <paulk@asert.com.au>
AuthorDate: Wed Apr 17 11:00:14 2019 +1000

    add an additional test method
---
 .../src/main/java/groovy/test/GroovyAssert.java            | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/subprojects/groovy-test/src/main/java/groovy/test/GroovyAssert.java b/subprojects/groovy-test/src/main/java/groovy/test/GroovyAssert.java
index 831f64a..917fed0 100644
--- a/subprojects/groovy-test/src/main/java/groovy/test/GroovyAssert.java
+++ b/subprojects/groovy-test/src/main/java/groovy/test/GroovyAssert.java
@@ -26,6 +26,7 @@ import org.junit.Test;
 
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
+import java.math.BigDecimal;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.logging.Logger;
 
@@ -333,6 +334,19 @@ public class GroovyAssert extends org.junit.Assert {
         return true;
     }
 
+    /**
+     * @return true if the JDK version is at least the version given by specVersion (e.g.
"1.8", "9.0")
+     * @since 2.5.7
+     */
+    public static boolean isAtLeastJdk(String specVersion) {
+        boolean result = false;
+        try {
+            result = new BigDecimal(System.getProperty("java.specification.version")).compareTo(new
BigDecimal(specVersion)) >= 0;
+        } catch (Exception ignore) {
+        }
+        return result;
+    }
+
     private static String buildExceptionList(Throwable th) {
         StringBuilder sb = new StringBuilder();
         int level = 0;


Mime
View raw message