changeset 210:d525cd24b29c draft

Added four new tests testGetEnumConstants(), testGetTypeParameters(), testGetSigners() and testDesiredAssertionStatus() into ScriptContextClassTest.
author Pavel Tisnovsky <ptisnovs@redhat.com>
date Tue, 13 Aug 2013 10:25:40 +0200
parents eabf4dfba019
children 3f08a736ce66
files ChangeLog src/org/RhinoTests/ScriptContextClassTest.java
diffstat 2 files changed, 45 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Aug 12 10:55:08 2013 +0200
+++ b/ChangeLog	Tue Aug 13 10:25:40 2013 +0200
@@ -1,3 +1,10 @@
+2013-08-13  Pavel Tisnovsky  <ptisnovs@redhat.com>
+
+	* src/org/RhinoTests/ScriptContextClassTest.java:
+	Added four new tests testGetEnumConstants(), testGetTypeParameters(),
+	testGetSigners() and testDesiredAssertionStatus()
+	into ScriptContextClassTest.
+
 2013-08-12  Pavel Tisnovsky  <ptisnovs@redhat.com>
 
 	* src/org/RhinoTests/CompiledScriptClassTest.java:
--- a/src/org/RhinoTests/ScriptContextClassTest.java	Mon Aug 12 10:55:08 2013 +0200
+++ b/src/org/RhinoTests/ScriptContextClassTest.java	Tue Aug 13 10:25:40 2013 +0200
@@ -52,6 +52,8 @@
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
 
 import javax.script.ScriptContext;
 import javax.script.SimpleScriptContext;
@@ -962,12 +964,15 @@
     protected void testGetAnnotations() {
         // following annotations should be provided
         final String[] annotationsThatShouldExists_jdk6 = {
+            // this should be really empty
         };
 
         final String[] annotationsThatShouldExists_jdk7 = {
+            // this should be really empty
         };
 
         final String[] annotationsThatShouldExists_jdk8 = {
+            // this should be really empty
         };
 
         // get all annotations
@@ -1122,6 +1127,39 @@
     }
 
     /**
+     * Test for method javax.script.ScriptContext.getClass().getEnumConstants()
+     */
+    protected void testGetEnumConstants() {
+        Object[] enumConstants = this.scriptContextClass.getEnumConstants();
+        assertNull(enumConstants, "getEnumConstants() does not return null");
+    }
+
+    /**
+     * Test for method javax.script.ScriptContext.getClass().getTypeParameters()
+     */
+    protected void testGetTypeParameters() {
+        TypeVariable<?>[] typeParameters = this.scriptContextClass.getTypeParameters();
+        assertNotNull(typeParameters, "getTypeParameters() return null");
+        assertEquals(0, typeParameters.length, "array of wrong size returned by getTypeParameters() " + typeParameters.length);
+    }
+
+    /**
+     * Test for method javax.script.ScriptContext.getClass().getSigners()
+     */
+    protected void testGetSigners() {
+        Object[] signers = this.scriptContextClass.getSigners();
+        assertNull(signers, "getSigners() does not return null");
+    }
+
+    /**
+     * Test for method javax.script.ScriptContext.getClass().desiredAssertionStatus()
+     */
+    protected void testDesiredAssertionStatus() {
+        assertFalse(this.scriptContextClass.desiredAssertionStatus(),
+                "Method ScriptContext.getClass().desiredAssertionStatus() returns wrong value");
+    }
+
+    /**
      * Test for instanceof operator applied to a class javax.script.ScriptContext
      */
     @SuppressWarnings("cast")