/hg/rhino-tests: Added two tests into
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Fri Nov 30 08:03:26 PST 2012
changeset 564fa4235e3e in /hg/rhino-tests
details: http://icedtea.classpath.org/hg/rhino-tests?cmd=changeset;node=564fa4235e3e
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Fri Nov 30 17:06:26 2012 +0100
Added two tests into
src/org/RhinoTests/AbstractScriptEngineClassTest.java and
src/org/RhinoTests/CompilableClassTest.java.
diffstat:
ChangeLog | 6 ++
src/org/RhinoTests/AbstractScriptEngineClassTest.java | 52 +++++++++++++++++++
src/org/RhinoTests/CompilableClassTest.java | 52 +++++++++++++++++++
3 files changed, 110 insertions(+), 0 deletions(-)
diffs (137 lines):
diff -r 9c72803a3232 -r 564fa4235e3e ChangeLog
--- a/ChangeLog Thu Nov 29 10:21:35 2012 +0100
+++ b/ChangeLog Fri Nov 30 17:06:26 2012 +0100
@@ -1,3 +1,9 @@
+2012-11-30 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * src/org/RhinoTests/AbstractScriptEngineClassTest.java:
+ * src/org/RhinoTests/CompilableClassTest.java:
+ Added two tests.
+
2012-11-29 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/RhinoTests/BindingsClassTest.java:
diff -r 9c72803a3232 -r 564fa4235e3e src/org/RhinoTests/AbstractScriptEngineClassTest.java
--- a/src/org/RhinoTests/AbstractScriptEngineClassTest.java Thu Nov 29 10:21:35 2012 +0100
+++ b/src/org/RhinoTests/AbstractScriptEngineClassTest.java Fri Nov 30 17:06:26 2012 +0100
@@ -506,6 +506,58 @@
}
/**
+ * Test for method javax.script.AbstractScriptEngine.getClass().getAnnotations()
+ */
+ protected void testGetAnnotations() {
+ // following annotations should be provided
+ final String[] annotationsThatShouldExists_jdk6 = {
+ };
+
+ final String[] annotationsThatShouldExists_jdk7 = {
+ };
+
+ // get all annotations
+ Annotation[] annotations = this.abstractScriptEngineClass.getAnnotations();
+ // and transform the array into a list of annotation names
+ List<String> annotationsAsString = new ArrayList<String>();
+ for (Annotation annotation : annotations) {
+ annotationsAsString.add(annotation.toString());
+ }
+ String[] annotationsThatShouldExists = getJavaVersion() < 7 ? annotationsThatShouldExists_jdk6 : annotationsThatShouldExists_jdk7;
+ // check if all required annotations really exists
+ for (String annotationThatShouldExists : annotationsThatShouldExists) {
+ assertTrue(annotationsAsString.contains(annotationThatShouldExists),
+ "annotation " + annotationThatShouldExists + " not found");
+ }
+ }
+
+ /**
+ * Test for method javax.script.AbstractScriptEngine.getClass().getDeclaredAnnotations()
+ */
+ protected void testGetDeclaredAnnotations() {
+ // following annotations should be provided
+ final String[] annotationsThatShouldExists_jdk6 = {
+ };
+
+ final String[] annotationsThatShouldExists_jdk7 = {
+ };
+
+ // get all annotations
+ Annotation[] annotations = this.abstractScriptEngineClass.getDeclaredAnnotations();
+ // and transform the array into a list of annotation names
+ List<String> annotationsAsString = new ArrayList<String>();
+ for (Annotation annotation : annotations) {
+ annotationsAsString.add(annotation.toString());
+ }
+ String[] annotationsThatShouldExists = getJavaVersion() < 7 ? annotationsThatShouldExists_jdk6 : annotationsThatShouldExists_jdk7;
+ // check if all required annotations really exists
+ for (String annotationThatShouldExists : annotationsThatShouldExists) {
+ assertTrue(annotationsAsString.contains(annotationThatShouldExists),
+ "annotation " + annotationThatShouldExists + " not found");
+ }
+ }
+
+ /**
* Test for instanceof operator applied to a class javax.script.AbstractScriptEngine
*/
@SuppressWarnings("cast")
diff -r 9c72803a3232 -r 564fa4235e3e src/org/RhinoTests/CompilableClassTest.java
--- a/src/org/RhinoTests/CompilableClassTest.java Thu Nov 29 10:21:35 2012 +0100
+++ b/src/org/RhinoTests/CompilableClassTest.java Fri Nov 30 17:06:26 2012 +0100
@@ -413,6 +413,58 @@
}
/**
+ * Test for method javax.script.Compilable.getClass().getAnnotations()
+ */
+ protected void testGetAnnotations() {
+ // following annotations should be provided
+ final String[] annotationsThatShouldExists_jdk6 = {
+ };
+
+ final String[] annotationsThatShouldExists_jdk7 = {
+ };
+
+ // get all annotations
+ Annotation[] annotations = this.compilableClass.getAnnotations();
+ // and transform the array into a list of annotation names
+ List<String> annotationsAsString = new ArrayList<String>();
+ for (Annotation annotation : annotations) {
+ annotationsAsString.add(annotation.toString());
+ }
+ String[] annotationsThatShouldExists = getJavaVersion() < 7 ? annotationsThatShouldExists_jdk6 : annotationsThatShouldExists_jdk7;
+ // check if all required annotations really exists
+ for (String annotationThatShouldExists : annotationsThatShouldExists) {
+ assertTrue(annotationsAsString.contains(annotationThatShouldExists),
+ "annotation " + annotationThatShouldExists + " not found");
+ }
+ }
+
+ /**
+ * Test for method javax.script.Compilable.getClass().getDeclaredAnnotations()
+ */
+ protected void testGetDeclaredAnnotations() {
+ // following annotations should be provided
+ final String[] annotationsThatShouldExists_jdk6 = {
+ };
+
+ final String[] annotationsThatShouldExists_jdk7 = {
+ };
+
+ // get all annotations
+ Annotation[] annotations = this.compilableClass.getDeclaredAnnotations();
+ // and transform the array into a list of annotation names
+ List<String> annotationsAsString = new ArrayList<String>();
+ for (Annotation annotation : annotations) {
+ annotationsAsString.add(annotation.toString());
+ }
+ String[] annotationsThatShouldExists = getJavaVersion() < 7 ? annotationsThatShouldExists_jdk6 : annotationsThatShouldExists_jdk7;
+ // check if all required annotations really exists
+ for (String annotationThatShouldExists : annotationsThatShouldExists) {
+ assertTrue(annotationsAsString.contains(annotationThatShouldExists),
+ "annotation " + annotationThatShouldExists + " not found");
+ }
+ }
+
+ /**
* Test for instanceof operator applied to a class javax.script.Compilable
*/
@SuppressWarnings("cast")
More information about the distro-pkg-dev
mailing list