changeset 38:be1b5714e3f0 draft

Five new tests & fixed some minor issues in src/org/RhinoTests/CompilableClassTest.java.
author Pavel Tisnovsky <ptisnovs@redhat.com>
date Wed, 19 Sep 2012 10:18:40 +0200
parents a699d77ef3a5
children c07fce915c2b
files ChangeLog src/org/RhinoTests/CompilableClassTest.java
diffstat 2 files changed, 65 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Sep 17 12:21:16 2012 +0200
+++ b/ChangeLog	Wed Sep 19 10:18:40 2012 +0200
@@ -1,3 +1,8 @@
+2012-09-19  Pavel Tisnovsky  <ptisnovs@redhat.com>
+
+	* src/org/RhinoTests/CompilableClassTest.java:
+	Five new tests & fixed some minor issues.
+
 2012-09-17  Pavel Tisnovsky  <ptisnovs@redhat.com>
 
 	* src/org/RhinoTests/AbstractScriptEngineClassTest.java:
--- a/src/org/RhinoTests/CompilableClassTest.java	Mon Sep 17 12:21:16 2012 +0200
+++ b/src/org/RhinoTests/CompilableClassTest.java	Wed Sep 19 10:18:40 2012 +0200
@@ -66,7 +66,7 @@
     /**
      * Object that represents the type of Compilable.
      */
-    Class compilableClass = null;
+    Class<?> compilableClass = null;
 
     @Override
     protected void setUp(String[] args) {
@@ -137,10 +137,64 @@
     }
 
     /**
+     * Test for method javax.script.Compilable.getClass().isAnnotation()
+     */
+    protected void testIsAnnotation() {
+        assertFalse(this.compilableClass.isAnnotation(),
+                "Method Compilable.getClass().isAnnotation() returns wrong value");
+    }
+
+    /**
+     * Test for method javax.script.Compilable.getClass().isAnnotationPresent()
+     */
+    protected void testIsAnnotationPresent() {
+        assertFalse(this.compilableClass.isAnnotationPresent(java.lang.annotation.Annotation.class),
+                "Method Compilable.getClass().isAnnotationPresent(java.lang.annotation.Annotation.class) returns wrong value");
+        assertFalse(this.compilableClass.isAnnotationPresent(java.lang.annotation.Documented.class),
+                "Method Compilable.getClass().isAnnotationPresent(java.lang.annotation.Documented.class) returns wrong value");
+        assertFalse(this.compilableClass.isAnnotationPresent(java.lang.annotation.Inherited.class),
+                "Method Compilable.getClass().isAnnotationPresent(java.lang.annotation.Inherited.class) returns wrong value");
+        assertFalse(this.compilableClass.isAnnotationPresent(java.lang.annotation.Retention.class),
+                "Method Compilable.getClass().isAnnotationPresent(java.lang.annotation.Retention.class) returns wrong value");
+        assertFalse(this.compilableClass.isAnnotationPresent(java.lang.annotation.Target.class),
+                "Method Compilable.getClass().isAnnotationPresent(java.lang.annotation.Target.class) returns wrong value");
+        assertFalse(this.compilableClass.isAnnotationPresent(java.lang.Deprecated.class),
+                "Method Compilable.getClass().isAnnotationPresent(java.lang.Deprecated.class) returns wrong value");
+        assertFalse(this.compilableClass.isAnnotationPresent(java.lang.Override.class),
+                "Method Compilable.getClass().isAnnotationPresent(java.lang.Override.class) returns wrong value");
+        assertFalse(this.compilableClass.isAnnotationPresent(java.lang.SuppressWarnings.class),
+                "Method Compilable.getClass().isAnnotationPresent(java.lang.SuppressWarnings.class) returns wrong value");
+    }
+
+    /**
+     * Test for method javax.script.Compilable.getClass().isAnonymousClass()
+     */
+    protected void testIsAnonymousClass() {
+        assertFalse(this.compilableClass.isAnonymousClass(),
+                "Method Compilable.getClass().isAnonymousClass() returns wrong value");
+    }
+
+    /**
+     * Test for method javax.script.Compilable.getClass().isArray()
+     */
+    protected void testIsArray() {
+        assertFalse(this.compilableClass.isArray(),
+                "Method Compilable.getClass().isArray() returns wrong value");
+    }
+
+    /**
+     * Test for method javax.script.Compilable.getClass().isEnum()
+     */
+    protected void testIsEnum() {
+        assertFalse(this.compilableClass.isEnum(),
+                "Method Compilable.getClass().isEnum() returns wrong value");
+    }
+
+    /**
      * Test for method javax.script.Compilable.getClass().getInterfaces()
      */
     protected void testGetInterfaces() {
-        List interfaces = Arrays.asList(this.compilableClass.getInterfaces());
+        List<Class<?>> interfaces = Arrays.asList(this.compilableClass.getInterfaces());
         assertTrue(interfaces.isEmpty(),
                 "list of implemented interfaces should be empty");
     }
@@ -208,7 +262,7 @@
      * Test for method javax.script.Compilable.getClass().getSuperclass()
      */
     protected void testGetSuperclass() {
-        Class superClass = this.compilableClass.getSuperclass();
+        Class<?> superClass = this.compilableClass.getSuperclass();
         assertNull(superClass,
                 "Method Compilable.getClass().getSuperclass() does not return null");
     }
@@ -217,7 +271,7 @@
      * Test for method javax.script.Compilable.getClass().getConstructors()
      */
     protected void testGetConstructors() {
-        Constructor[] constructors = this.compilableClass.getConstructors();
+        Constructor<?>[] constructors = this.compilableClass.getConstructors();
         assertEquals(constructors.length, 0, "no constructors should be set");
     }
 
@@ -225,7 +279,7 @@
      * Test for method javax.script.Compilable.getClass().getDeclaredConstructors()
      */
     protected void testGetDeclaredConstructors() {
-        Constructor[] constructors = this.compilableClass.getDeclaredConstructors();
+        Constructor<?>[] constructors = this.compilableClass.getDeclaredConstructors();
         assertEquals(constructors.length, 0, "no constructors should be set");
     }
 
@@ -320,6 +374,7 @@
     /**
      * Test for instanceof operator applied to a class javax.script.Compilable
      */
+    @SuppressWarnings("cast")
     protected void testInstanceOf() {
         // tested object
         Object o = (Compilable)(new ScriptEngineManager().getEngineByName(Constants.EngineNames.ENGINE_NAME_JavaScript));