/hg/rhino-tests: Added three new tests into the test case src/or...

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Tue Dec 18 01:45:55 PST 2012


changeset 499bf38b565f in /hg/rhino-tests
details: http://icedtea.classpath.org/hg/rhino-tests?cmd=changeset;node=499bf38b565f
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Tue Dec 18 10:49:01 2012 +0100

	Added three new tests into the test case src/org/RhinoTests/ScriptEngineFactoryClassTest.java.


diffstat:

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

diffs (111 lines):

diff -r 6ca3cde5c86f -r 499bf38b565f ChangeLog
--- a/ChangeLog	Mon Dec 17 10:54:42 2012 +0100
+++ b/ChangeLog	Tue Dec 18 10:49:01 2012 +0100
@@ -1,3 +1,8 @@
+2012-12-18  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/RhinoTests/ScriptEngineFactoryClassTest.java:
+	Added three new tests into this test case.
+
 2012-12-17  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/org/RhinoTests/ScriptContextClassTest.java:
diff -r 6ca3cde5c86f -r 499bf38b565f src/org/RhinoTests/ScriptEngineFactoryClassTest.java
--- a/src/org/RhinoTests/ScriptEngineFactoryClassTest.java	Mon Dec 17 10:54:42 2012 +0100
+++ b/src/org/RhinoTests/ScriptEngineFactoryClassTest.java	Tue Dec 18 10:49:01 2012 +0100
@@ -46,6 +46,7 @@
 import java.util.Map;
 import java.util.HashMap;
 
+import java.lang.annotation.Annotation;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
@@ -355,6 +356,28 @@
     }
 
     /**
+     * Test for method javax.script.ScriptEngineFactory.getClass().getField()
+     */
+    protected void testGetField() {
+        // following fields should exists
+        final String[] fieldsThatShouldExists = {
+        };
+        // check if all required fields really exists
+        for (String fieldThatShouldExists : fieldsThatShouldExists) {
+            try {
+                Field field = this.scriptEngineFactoryClass.getField(fieldThatShouldExists);
+                String fieldName = field.getName();
+                assertTrue(fieldName.equals(fieldThatShouldExists),
+                        "field " + fieldThatShouldExists + " not found");
+            }
+            catch (Exception e) {
+                e.printStackTrace();
+                throw new AssertionError(e.getMessage());
+            }
+        }
+    }
+
+    /**
      * Test for method javax.script.ScriptEngineFactory.getClass().getMethods()
      */
     protected void testGetMethods() {
@@ -455,6 +478,58 @@
     }
 
     /**
+     * Test for method javax.script.ScriptEngineFactory.getClass().getAnnotations()
+     */
+    protected void testGetAnnotations() {
+        // following annotations should be provided
+        final String[] annotationsThatShouldExists_jdk6 = {
+        };
+
+        final String[] annotationsThatShouldExists_jdk7 = {
+        };
+
+        // get all annotations
+        Annotation[] annotations = this.scriptEngineFactoryClass.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.ScriptEngineFactory.getClass().getDeclaredAnnotations()
+     */
+    protected void testGetDeclaredAnnotations() {
+        // following annotations should be provided
+        final String[] annotationsThatShouldExists_jdk6 = {
+        };
+
+        final String[] annotationsThatShouldExists_jdk7 = {
+        };
+
+        // get all annotations
+        Annotation[] annotations = this.scriptEngineFactoryClass.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.ScriptEngineFactory
      */
     @SuppressWarnings("cast")



More information about the distro-pkg-dev mailing list