You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by vl...@apache.org on 2022/05/31 17:32:32 UTC

[tapestry-5] branch master updated: Move tests depending on latest Java to tapestry-latest-java-tests.

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

vlamp pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tapestry-5.git


The following commit(s) were added to refs/heads/master by this push:
     new 2836342a6 Move tests depending on latest Java to tapestry-latest-java-tests.
2836342a6 is described below

commit 2836342a6a90f09c35a0ed6e35c02c8184cb7920
Author: Volker Lamp <vl...@apache.org>
AuthorDate: Tue May 31 17:35:49 2022 +0200

    Move tests depending on latest Java to tapestry-latest-java-tests.
---
 .../groovy/ioc/specs/InheritanceSearchSpec.groovy  | 29 ++-------------
 tapestry-latest-java-tests/build.gradle            |  8 ++++-
 .../specs/InheritanceSearchLatestJavaSpec.groovy   | 41 ++++++++++++++++++++++
 3 files changed, 51 insertions(+), 27 deletions(-)

diff --git a/tapestry-ioc/src/test/groovy/ioc/specs/InheritanceSearchSpec.groovy b/tapestry-ioc/src/test/groovy/ioc/specs/InheritanceSearchSpec.groovy
index eb7819d2a..70791b5c3 100644
--- a/tapestry-ioc/src/test/groovy/ioc/specs/InheritanceSearchSpec.groovy
+++ b/tapestry-ioc/src/test/groovy/ioc/specs/InheritanceSearchSpec.groovy
@@ -61,7 +61,6 @@ class InheritanceSearchSpec extends Specification {
     Comparable   | [Comparable, Object]
     ToyTruck     | [ToyTruck, Playable, Drivable, Object]
     ToyTruckImpl | [ToyTruckImpl, PlayableImpl, DrivableImpl, Drivable, ToyTruck, Playable, Object]
-    long         | [long, Long, Number, Comparable, Serializable, Object]
     void         | [void, Object]
     long[]       | [long[], Cloneable, Serializable, Object]
     int[][]      | [int[][], Cloneable, Serializable, Object]
@@ -73,7 +72,7 @@ class InheritanceSearchSpec extends Specification {
 
   }
 
-  @IgnoreIf(value = { jvm.java12Compatible })
+  @IgnoreIf(value = { jvm.java12Compatible }, reason = "The class hierarchy for the classes listed in the 'where' section changed in Java 12. A complementary spec was added to 'tapestry-latest-java-tests' to account for the added classes.")
   @Unroll
   def "inheritance of #className is #expectedNames (Java < 12)"() {
 	def search = new InheritanceSearch(clazz)
@@ -90,30 +89,8 @@ class InheritanceSearchSpec extends Specification {
 
 	clazz        | expected
 	String       | [String, Serializable, Comparable, CharSequence, Object]
-
-	className = PlasticUtils.toTypeName(clazz)
-	expectedNames = expected.collect { PlasticUtils.toTypeName(it) }.join(", ")
-
-  }
-
-    
-  @IgnoreIf(value = { !jvm.java12Compatible })
-  @Unroll
-  def "inheritance of #className is #expectedNames (Java 12+)"() {
-	def search = new InheritanceSearch(clazz)
-	def result = []
-	while (search.hasNext()) {
-	  result << search.next()
-	}
-
-	expect:
-
-	result == expected
-
-	where:
-
-	clazz        | expected
-	String       | [String, Serializable, Comparable, CharSequence, Constable, ConstantDesc, Object]
+	long         | [long, Long, Number, Comparable, Serializable, Object]
+	
 
 	className = PlasticUtils.toTypeName(clazz)
 	expectedNames = expected.collect { PlasticUtils.toTypeName(it) }.join(", ")
diff --git a/tapestry-latest-java-tests/build.gradle b/tapestry-latest-java-tests/build.gradle
index 92267afe7..ba43a9fd3 100644
--- a/tapestry-latest-java-tests/build.gradle
+++ b/tapestry-latest-java-tests/build.gradle
@@ -8,6 +8,12 @@ tasks.withType(JavaCompile).each {
 }
 
 test {
+    dependsOn 'testNG'
+    useJUnitPlatform()
+    jvmArgs(["--enable-preview"])
+}
+
+tasks.register('testNG', Test) {
     useTestNG()
     jvmArgs(["--enable-preview"])
 }
@@ -16,4 +22,4 @@ dependencies {
     testImplementation project(':tapestry-ioc')
     testImplementation "org.slf4j:slf4j-api:${versions.slf4j}"
     testImplementation "org.testng:testng:${versions.testng}"
-}
\ No newline at end of file
+}
diff --git a/tapestry-latest-java-tests/src/test/groovy/ioc/specs/InheritanceSearchLatestJavaSpec.groovy b/tapestry-latest-java-tests/src/test/groovy/ioc/specs/InheritanceSearchLatestJavaSpec.groovy
new file mode 100644
index 000000000..c86c0193a
--- /dev/null
+++ b/tapestry-latest-java-tests/src/test/groovy/ioc/specs/InheritanceSearchLatestJavaSpec.groovy
@@ -0,0 +1,41 @@
+package ioc.specs
+
+import org.apache.tapestry5.commons.internal.util.InheritanceSearch
+import org.apache.tapestry5.plastic.PlasticUtils
+
+import java.lang.constant.Constable
+import java.lang.constant.ConstantDesc
+
+import spock.lang.Specification
+import spock.lang.Unroll
+
+/**
+ * Complements InheritanceSearchSpec from tapestry-ioc.
+ */
+class InheritanceSearchLatestJavaSpec extends Specification {
+
+  @Unroll
+  def "inheritance of #className is #expectedNames (latest Java)"() {
+	def search = new InheritanceSearch(clazz)
+	def result = []
+	while (search.hasNext()) {
+	  result << search.next()
+	}
+
+	expect:
+
+	result == expected
+
+	where:
+
+	clazz        | expected
+	String       | [String, Serializable, Comparable, CharSequence, Constable, ConstantDesc, Object]
+	long         | [long, Long, Number, Comparable, Constable, ConstantDesc, Serializable, Object]
+	
+
+	className = PlasticUtils.toTypeName(clazz)
+	expectedNames = expected.collect { PlasticUtils.toTypeName(it) }.join(", ")
+
+  }
+
+}