/hg/rhino-tests: Updated to work correctly in JDK6-JDK8.

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Tue Jun 4 01:22:02 PDT 2013


changeset 704a31613698 in /hg/rhino-tests
details: http://icedtea.classpath.org/hg/rhino-tests?cmd=changeset;node=704a31613698
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Tue Jun 04 10:25:30 2013 +0200

	Updated to work correctly in JDK6-JDK8.


diffstat:

 ChangeLog                                            |   5 ++
 src/org/RhinoTests/ScriptEngineFactoryClassTest.java |  36 ++++++++++++++++++-
 2 files changed, 39 insertions(+), 2 deletions(-)

diffs (79 lines):

diff -r 5d030140c10f -r 704a31613698 ChangeLog
--- a/ChangeLog	Mon Jun 03 11:50:42 2013 +0200
+++ b/ChangeLog	Tue Jun 04 10:25:30 2013 +0200
@@ -1,3 +1,8 @@
+2013-06-04  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/RhinoTests/ScriptEngineFactoryClassTest.java:
+	Updated to work correctly in JDK6-JDK8.
+
 2013-06-03  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/org/RhinoTests/ScriptContextClassTest.java:
diff -r 5d030140c10f -r 704a31613698 src/org/RhinoTests/ScriptEngineFactoryClassTest.java
--- a/src/org/RhinoTests/ScriptEngineFactoryClassTest.java	Mon Jun 03 11:50:42 2013 +0200
+++ b/src/org/RhinoTests/ScriptEngineFactoryClassTest.java	Tue Jun 04 10:25:30 2013 +0200
@@ -919,6 +919,9 @@
         final String[] annotationsThatShouldExists_jdk7 = {
         };
 
+        final String[] annotationsThatShouldExists_jdk8 = {
+        };
+
         // get all annotations
         Annotation[] annotations = this.scriptEngineFactoryClass.getAnnotations();
         // and transform the array into a list of annotation names
@@ -926,7 +929,20 @@
         for (Annotation annotation : annotations) {
             annotationsAsString.add(annotation.toString());
         }
-        String[] annotationsThatShouldExists = getJavaVersion() < 7 ? annotationsThatShouldExists_jdk6 : annotationsThatShouldExists_jdk7;
+
+        String[] annotationsThatShouldExists = null;
+        switch (getJavaVersion()) {
+            case 6:
+                annotationsThatShouldExists = annotationsThatShouldExists_jdk6;
+                break;
+            case 7:
+                annotationsThatShouldExists = annotationsThatShouldExists_jdk7;
+                break;
+            case 8:
+                annotationsThatShouldExists = annotationsThatShouldExists_jdk8;
+                break;
+        }
+
         // check if all required annotations really exists
         for (String annotationThatShouldExists : annotationsThatShouldExists) {
             assertTrue(annotationsAsString.contains(annotationThatShouldExists),
@@ -945,6 +961,9 @@
         final String[] annotationsThatShouldExists_jdk7 = {
         };
 
+        final String[] annotationsThatShouldExists_jdk8 = {
+        };
+
         // get all annotations
         Annotation[] annotations = this.scriptEngineFactoryClass.getDeclaredAnnotations();
         // and transform the array into a list of annotation names
@@ -952,7 +971,20 @@
         for (Annotation annotation : annotations) {
             annotationsAsString.add(annotation.toString());
         }
-        String[] annotationsThatShouldExists = getJavaVersion() < 7 ? annotationsThatShouldExists_jdk6 : annotationsThatShouldExists_jdk7;
+
+        String[] annotationsThatShouldExists = null;
+        switch (getJavaVersion()) {
+            case 6:
+                annotationsThatShouldExists = annotationsThatShouldExists_jdk6;
+                break;
+            case 7:
+                annotationsThatShouldExists = annotationsThatShouldExists_jdk7;
+                break;
+            case 8:
+                annotationsThatShouldExists = annotationsThatShouldExists_jdk8;
+                break;
+        }
+
         // check if all required annotations really exists
         for (String annotationThatShouldExists : annotationsThatShouldExists) {
             assertTrue(annotationsAsString.contains(annotationThatShouldExists),



More information about the distro-pkg-dev mailing list