/hg/rhino-tests: Updated SimpleScriptContextClassTest to work co...

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Fri Jun 14 01:10:20 PDT 2013


changeset 6fb422bd339f in /hg/rhino-tests
details: http://icedtea.classpath.org/hg/rhino-tests?cmd=changeset;node=6fb422bd339f
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Fri Jun 14 10:13:51 2013 +0200

	Updated SimpleScriptContextClassTest to work correctly in JDK6-JDK8.


diffstat:

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

diffs (79 lines):

diff -r 7bd1fe8fb827 -r 6fb422bd339f ChangeLog
--- a/ChangeLog	Thu Jun 13 14:21:04 2013 +0200
+++ b/ChangeLog	Fri Jun 14 10:13:51 2013 +0200
@@ -1,3 +1,8 @@
+2013-06-14  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/RhinoTests/SimpleScriptContextClassTest.java:
+	Updated SimpleScriptContextClassTest to work correctly in JDK6-JDK8.
+
 2013-06-13  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/org/RhinoTests/ScriptEngineManagerClassTest.java:
diff -r 7bd1fe8fb827 -r 6fb422bd339f src/org/RhinoTests/SimpleScriptContextClassTest.java
--- a/src/org/RhinoTests/SimpleScriptContextClassTest.java	Thu Jun 13 14:21:04 2013 +0200
+++ b/src/org/RhinoTests/SimpleScriptContextClassTest.java	Fri Jun 14 10:13:51 2013 +0200
@@ -1076,6 +1076,9 @@
         final String[] annotationsThatShouldExists_jdk7 = {
         };
 
+        final String[] annotationsThatShouldExists_jdk8 = {
+        };
+
         // get all annotations
         Annotation[] annotations = this.simpleScriptContextClass.getAnnotations();
         // and transform the array into a list of annotation names
@@ -1083,7 +1086,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),
@@ -1102,6 +1118,9 @@
         final String[] annotationsThatShouldExists_jdk7 = {
         };
 
+        final String[] annotationsThatShouldExists_jdk8 = {
+        };
+
         // get all annotations
         Annotation[] annotations = this.simpleScriptContextClass.getDeclaredAnnotations();
         // and transform the array into a list of annotation names
@@ -1109,7 +1128,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