/hg/rhino-tests: Added new tests for methods GetCanonicalName() ...

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Tue Jan 8 01:50:37 PST 2013


changeset 7f25cbe3c551 in /hg/rhino-tests
details: http://icedtea.classpath.org/hg/rhino-tests?cmd=changeset;node=7f25cbe3c551
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Tue Jan 08 10:53:46 2013 +0100

	Added new tests for methods GetCanonicalName() and getAnnotation().
	Fixed spelling.


diffstat:

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

diffs (110 lines):

diff -r 87019bd63c13 -r 7f25cbe3c551 ChangeLog
--- a/ChangeLog	Mon Jan 07 10:57:47 2013 +0100
+++ b/ChangeLog	Tue Jan 08 10:53:46 2013 +0100
@@ -1,3 +1,9 @@
+2013-01-08  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/RhinoTests/SimpleScriptContextClassTest.java:
+	Added new test for a method GetCanonicalName() getAnnotation().
+	Fixed spelling.
+
 2013-01-07  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/org/RhinoTests/AbstractScriptEngineClassTest.java:
diff -r 87019bd63c13 -r 7f25cbe3c551 src/org/RhinoTests/SimpleScriptContextClassTest.java
--- a/src/org/RhinoTests/SimpleScriptContextClassTest.java	Mon Jan 07 10:57:47 2013 +0100
+++ b/src/org/RhinoTests/SimpleScriptContextClassTest.java	Tue Jan 08 10:53:46 2013 +0100
@@ -1,7 +1,7 @@
 /*
   Rhino test framework
 
-   Copyright (C) 2011, 2012  Red Hat
+   Copyright (C) 2011, 2012, 2013  Red Hat
 
 This file is part of IcedTea.
 
@@ -45,6 +45,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.HashMap;
+import java.util.TreeMap;
 
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Constructor;
@@ -267,6 +268,15 @@
     }
 
     /**
+     * Test for method javax.script.SimpleScriptContext.getClass().getCanonicalName()
+     */
+    protected void testGetCanonicalName() {
+        String canonicalName = this.simpleScriptContextClass.getCanonicalName();
+        assertEquals(canonicalName, "javax.script.SimpleScriptContext",
+                "Method javax.script.SimpleScriptContext.getClass().getCanonicalName() returns wrong value " + canonicalName);
+    }
+
+    /**
      * Test for method javax.script.SimpleScriptContext.getClass().getSuperclass()
      */
     protected void testGetSuperclass() {
@@ -487,7 +497,7 @@
      */
     protected void testGetDeclaredMethods() {
         // following methods should be declared
-        final String[] declaredMethodsThatShouldExists_jdk6 = {
+        final String[] declaredMethodsThatShouldExist_jdk6 = {
             "public int javax.script.SimpleScriptContext.getAttributesScope(java.lang.String)",
             "public java.io.Reader javax.script.SimpleScriptContext.getReader()",
             "public java.io.Writer javax.script.SimpleScriptContext.getErrorWriter()",
@@ -504,7 +514,7 @@
             "public void javax.script.SimpleScriptContext.setWriter(java.io.Writer)",
         };
 
-        final String[] declaredMethodsThatShouldExists_jdk7 = {
+        final String[] declaredMethodsThatShouldExist_jdk7 = {
             "public int javax.script.SimpleScriptContext.getAttributesScope(java.lang.String)",
             "public java.io.Reader javax.script.SimpleScriptContext.getReader()",
             "public java.io.Writer javax.script.SimpleScriptContext.getErrorWriter()",
@@ -528,9 +538,10 @@
         for (Method method : declaredMethods) {
             methodsAsString.add(method.toString());
         }
-        String[] declaredMethodsThatShouldExists = getJavaVersion() < 7 ? declaredMethodsThatShouldExists_jdk6 : declaredMethodsThatShouldExists_jdk7;
+
+        String[] declaredMethodsThatShouldExist = getJavaVersion() < 7 ? declaredMethodsThatShouldExist_jdk6 : declaredMethodsThatShouldExist_jdk7;
         // check if all required methods really exists
-        for (String methodThatShouldExists : declaredMethodsThatShouldExists) {
+        for (String methodThatShouldExists : declaredMethodsThatShouldExist) {
             assertTrue(methodsAsString.contains(methodThatShouldExists),
                     "declared method " + methodThatShouldExists + " not found");
         }
@@ -589,6 +600,29 @@
     }
 
     /**
+     * Test for method javax.script.SimpleScriptContext.getClass().getAnnotation()
+     */
+    protected void testGetAnnotation() {
+        Annotation annotation;
+        annotation = this.simpleScriptContextClass.getAnnotation(java.lang.annotation.Annotation.class);
+        assertNull(annotation, "annotation java.lang.annotation.Annotation should not be returned");
+        annotation = this.simpleScriptContextClass.getAnnotation(java.lang.annotation.Documented.class);
+        assertNull(annotation, "annotation java.lang.annotation.Documented should not be returned");
+        annotation = this.simpleScriptContextClass.getAnnotation(java.lang.annotation.Inherited.class);
+        assertNull(annotation, "annotation java.lang.annotation.Inherited should not be returned");
+        annotation = this.simpleScriptContextClass.getAnnotation(java.lang.annotation.Retention.class);
+        assertNull(annotation, "annotation java.lang.annotation.Retention should not be returned");
+        annotation = this.simpleScriptContextClass.getAnnotation(java.lang.annotation.Target.class);
+        assertNull(annotation, "annotation java.lang.annotation.Target should not be returned");
+        annotation = this.simpleScriptContextClass.getAnnotation(java.lang.Deprecated.class);
+        assertNull(annotation, "annotation java.lang.Deprecated should not be returned");
+        annotation = this.simpleScriptContextClass.getAnnotation(java.lang.Override.class);
+        assertNull(annotation, "annotation java.lang.Override should not be returned");
+        annotation = this.simpleScriptContextClass.getAnnotation(java.lang.SuppressWarnings.class);
+        assertNull(annotation, "annotation java.lang.SuppressWarnings should not be returned");
+    }
+
+    /**
      * Test for instanceof operator applied to a class javax.script.SimpleScriptContext
      */
     @SuppressWarnings("cast")



More information about the distro-pkg-dev mailing list