/hg/rhino-tests: Updated ScriptContextClassTest to work correctl...
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Wed Jun 5 01:39:15 PDT 2013
changeset 4de9c7877164 in /hg/rhino-tests
details: http://icedtea.classpath.org/hg/rhino-tests?cmd=changeset;node=4de9c7877164
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Wed Jun 05 10:42:41 2013 +0200
Updated ScriptContextClassTest to work correctly in JDK6-JDK8.
diffstat:
ChangeLog | 5 +++
src/org/RhinoTests/ScriptContextClassTest.java | 36 ++++++++++++++++++++++++-
2 files changed, 39 insertions(+), 2 deletions(-)
diffs (79 lines):
diff -r 704a31613698 -r 4de9c7877164 ChangeLog
--- a/ChangeLog Tue Jun 04 10:25:30 2013 +0200
+++ b/ChangeLog Wed Jun 05 10:42:41 2013 +0200
@@ -1,3 +1,8 @@
+2013-06-05 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * src/org/RhinoTests/ScriptContextClassTest.java:
+ Updated ScriptContextClassTest to work correctly in JDK6-JDK8.
+
2013-06-04 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/RhinoTests/ScriptEngineFactoryClassTest.java:
diff -r 704a31613698 -r 4de9c7877164 src/org/RhinoTests/ScriptContextClassTest.java
--- a/src/org/RhinoTests/ScriptContextClassTest.java Tue Jun 04 10:25:30 2013 +0200
+++ b/src/org/RhinoTests/ScriptContextClassTest.java Wed Jun 05 10:42:41 2013 +0200
@@ -967,6 +967,9 @@
final String[] annotationsThatShouldExists_jdk7 = {
};
+ final String[] annotationsThatShouldExists_jdk8 = {
+ };
+
// get all annotations
Annotation[] annotations = this.scriptContextClass.getAnnotations();
// and transform the array into a list of annotation names
@@ -974,7 +977,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),
@@ -993,6 +1009,9 @@
final String[] annotationsThatShouldExists_jdk7 = {
};
+ final String[] annotationsThatShouldExists_jdk8 = {
+ };
+
// get all annotations
Annotation[] annotations = this.scriptContextClass.getDeclaredAnnotations();
// and transform the array into a list of annotation names
@@ -1000,7 +1019,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