[java-support] branch maint-7 updated: JPAR-104 - allow tests to check for Java 11 or later

Ian Young ian at iay.org.uk
Tue Jan 29 07:13:52 EST 2019


This is an automated email from the git hooks/post-receive script.

iay pushed a commit to branch maint-7
in repository java-support.

View the commit online:
http://git.shibboleth.net/view/?p=java-support.git;a=commit;h=d75489a249f45cecb37a396014766d46131c5c60

The following commit(s) were added to refs/heads/maint-7 by this push:
       new  d75489a   JPAR-104 - allow tests to check for Java 11 or later
d75489a is described below

commit d75489a249f45cecb37a396014766d46131c5c60
Author: Ian Young <ian at iay.org.uk>
AuthorDate: Mon Jan 28 15:48:48 2019 +0000

    JPAR-104 - allow tests to check for Java 11 or later
---
 .../utilities/java/support/testing/TestSupport.java        | 14 ++++++++++++--
 .../utilities/java/support/testing/TestSupportTest.java    |  7 +++++++
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/src/test/java/net/shibboleth/utilities/java/support/testing/TestSupport.java b/src/test/java/net/shibboleth/utilities/java/support/testing/TestSupport.java
index 5e82788..0088991 100644
--- a/src/test/java/net/shibboleth/utilities/java/support/testing/TestSupport.java
+++ b/src/test/java/net/shibboleth/utilities/java/support/testing/TestSupport.java
@@ -129,13 +129,23 @@ public class TestSupport {
     }
 
     /**
-     * Indicates whether the tests are running under Java 8 or a later
+     * Indicates whether the tests are running under Java 9 or a later
      * version.
      *
-     * @return <code>true</code> if the runtime environment is Java 8 or later
+     * @return <code>true</code> if the runtime environment is Java 9 or later
      */
     public static boolean isJavaV9OrLater() {
         return getJavaVersion(System.getProperty("java.version")) >= 9;
     }
 
+    /**
+     * Indicates whether the tests are running under Java 11 or a later
+     * version.
+     *
+     * @return <code>true</code> if the runtime environment is Java 11 or later
+     */
+    public static boolean isJavaV11OrLater() {
+        return getJavaVersion(System.getProperty("java.version")) >= 11;
+    }
+
 }
diff --git a/src/test/java/net/shibboleth/utilities/java/support/testing/TestSupportTest.java b/src/test/java/net/shibboleth/utilities/java/support/testing/TestSupportTest.java
index cc987f1..1e60286 100644
--- a/src/test/java/net/shibboleth/utilities/java/support/testing/TestSupportTest.java
+++ b/src/test/java/net/shibboleth/utilities/java/support/testing/TestSupportTest.java
@@ -25,6 +25,12 @@ public class TestSupportTest {
     }
 
     @Test
+    public void isJavaV11OrLater() {
+        // answer for current runtime can be true or false, just not an exception
+        TestSupport.isJavaV11OrLater();
+    }
+
+    @Test
     public void getJavaVersion() {
         // test against some real versions
         Assert.assertEquals(TestSupport.getJavaVersion("1.6.0_65-b14-468"), 6);
@@ -33,6 +39,7 @@ public class TestSupportTest {
         Assert.assertEquals(TestSupport.getJavaVersion("9"), 9);
         Assert.assertEquals(TestSupport.getJavaVersion("9.0.1"), 9);
         Assert.assertEquals(TestSupport.getJavaVersion("10+43"), 10); // Java 10 RC
+        Assert.assertEquals(TestSupport.getJavaVersion("11.0.2"), 11);
     }
 
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list