polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paulmer...@apache.org
Subject [2/3] polygene-java git commit: Skip default interface methods tests on JDK 9
Date Mon, 15 May 2017 16:26:59 GMT
Skip default interface methods tests on JDK 9

POLYGENE-251
POLYGENE-253


Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/cf15aa43
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/cf15aa43
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/cf15aa43

Branch: refs/heads/develop
Commit: cf15aa4307b40e253d2b1c14e170c4d30ba3867b
Parents: 3a6ac25
Author: Paul Merlin <paulmerlin@apache.org>
Authored: Mon May 15 17:48:57 2017 +0200
Committer: Paul Merlin <paulmerlin@apache.org>
Committed: Mon May 15 18:21:26 2017 +0200

----------------------------------------------------------------------
 .../runtime/composite/InterfaceDefaultMethodsTest.java  |  5 +++++
 .../polygene/runtime/mixin/DefaultMethodsTest.java      |  6 ++++--
 .../main/java/org/apache/polygene/test/util/Assume.java | 12 +++++++++++-
 3 files changed, 20 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/cf15aa43/core/runtime/src/test/java/org/apache/polygene/runtime/composite/InterfaceDefaultMethodsTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/composite/InterfaceDefaultMethodsTest.java
b/core/runtime/src/test/java/org/apache/polygene/runtime/composite/InterfaceDefaultMethodsTest.java
index 806f981..f70ced7 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/composite/InterfaceDefaultMethodsTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/composite/InterfaceDefaultMethodsTest.java
@@ -32,8 +32,10 @@ import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.library.constraints.annotation.NotEmpty;
 import org.apache.polygene.test.AbstractPolygeneTest;
+import org.junit.BeforeClass;
 import org.junit.Test;
 
+import static org.apache.polygene.test.util.Assume.assumeJavaVersion;
 import static org.hamcrest.Matchers.containsString;
 import static org.hamcrest.Matchers.equalTo;
 import static org.junit.Assert.assertThat;
@@ -43,6 +45,9 @@ import static org.junit.Assert.assertThat;
  */
 public class InterfaceDefaultMethodsTest extends AbstractPolygeneTest
 {
+    @BeforeClass
+    public static void assumeJavaVersionIs8() { assumeJavaVersion( 8 ); }
+
     public interface DefaultMethods
     {
         @UseDefaults( "Hello" )

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/cf15aa43/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/DefaultMethodsTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/DefaultMethodsTest.java
b/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/DefaultMethodsTest.java
index 320d98b..20f22be 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/DefaultMethodsTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/DefaultMethodsTest.java
@@ -23,8 +23,10 @@ import org.apache.polygene.api.value.ValueBuilder;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.test.AbstractPolygeneTest;
+import org.junit.BeforeClass;
 import org.junit.Test;
 
+import static org.apache.polygene.test.util.Assume.assumeJavaVersion;
 import static org.hamcrest.core.IsEqual.equalTo;
 import static org.junit.Assert.assertThat;
 
@@ -33,6 +35,8 @@ import static org.junit.Assert.assertThat;
  */
 public class DefaultMethodsTest extends AbstractPolygeneTest
 {
+    @BeforeClass
+    public static void assumeJavaVersionIs8() { assumeJavaVersion( 8 ); }
 
     @Override
     public void assemble( ModuleAssembly module )
@@ -64,7 +68,6 @@ public class DefaultMethodsTest extends AbstractPolygeneTest
         Hello hello = builder.newInstance();
         assertThat( hello.speak(), equalTo( "Hello, Mixin!" ) );
         assertThat( Hello.noise(), equalTo( "Good Bye" ) );
-
     }
 
     public interface Hello
@@ -91,5 +94,4 @@ public class DefaultMethodsTest extends AbstractPolygeneTest
             return phrase().get() + ", Mixin!";
         }
     }
-
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/cf15aa43/core/testsupport/src/main/java/org/apache/polygene/test/util/Assume.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/util/Assume.java b/core/testsupport/src/main/java/org/apache/polygene/test/util/Assume.java
index 96ee180..ec65719 100644
--- a/core/testsupport/src/main/java/org/apache/polygene/test/util/Assume.java
+++ b/core/testsupport/src/main/java/org/apache/polygene/test/util/Assume.java
@@ -28,6 +28,7 @@ import java.util.Enumeration;
 
 import static org.hamcrest.core.Is.is;
 import static org.hamcrest.core.IsNull.notNullValue;
+import static org.hamcrest.core.StringStartsWith.startsWith;
 
 /**
  * A set of methods useful for stating assumptions about the conditions in which a test is
meaningful.
@@ -35,6 +36,14 @@ import static org.hamcrest.core.IsNull.notNullValue;
 public class Assume
     extends org.junit.Assume
 {
+    /**
+     * If called on a JDK which version is different than the given one, the test will halt
and be ignored.
+     * @param version the java version, 6, 7, 8, 9, 10
+     */
+    public static void assumeJavaVersion( int version )
+    {
+        assumeThat( System.getProperty( "java.version" ), startsWith( "1." + version ) );
+    }
 
     /**
      * If called on a IBM JDK, the test will halt and be ignored.
@@ -55,7 +64,8 @@ public class Assume
             String display = System.getenv( "DISPLAY" );
             assumeThat( display, is( notNullValue() ) );
             assumeTrue( display.length() > 0 );
-        } catch( UnsatisfiedLinkError e )
+        }
+        catch( UnsatisfiedLinkError e )
         {
             // assuming that this is caused due to missing video subsystem, or similar
             assumeNoException( "Grahics system is missing?", e );


Mime
View raw message