changeset 216:0f16f7c5be85 draft

Added new test testAsSubclass into the test suite AbstractScriptEngineClassTest.
author Pavel Tisnovsky <ptisnovs@redhat.com>
date Thu, 22 Aug 2013 16:05:57 +0200
parents 5674e01de2f4
children 925693e5b8eb
files ChangeLog src/org/RhinoTests/AbstractScriptEngineClassTest.java
diffstat 2 files changed, 171 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Aug 20 11:19:35 2013 +0200
+++ b/ChangeLog	Thu Aug 22 16:05:57 2013 +0200
@@ -1,3 +1,8 @@
+2013-08-21  Pavel Tisnovsky  <ptisnovs@redhat.com>
+
+	* src/org/RhinoTests/AbstractScriptEngineClassTest.java:
+	Added new test testAsSubclass into the test suite AbstractScriptEngineClassTest.
+
 2013-08-20  Pavel Tisnovsky  <ptisnovs@redhat.com>
 
 	* src/org/RhinoTests/CompiledScriptTest.java:
--- a/src/org/RhinoTests/AbstractScriptEngineClassTest.java	Tue Aug 20 11:19:35 2013 +0200
+++ b/src/org/RhinoTests/AbstractScriptEngineClassTest.java	Thu Aug 22 16:05:57 2013 +0200
@@ -1321,6 +1321,172 @@
     }
 
     /**
+     * Test for method javax.script.AbstractScriptEngine.getClass().asSubclass()
+     */
+    protected void testAsSubclass() {
+        try {
+            this.abstractScriptEngineClass.asSubclass(abstractScriptEngineClass);
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+            throw new AssertionError(e.getMessage());
+        }
+
+        try {
+            this.abstractScriptEngineClass.asSubclass(Object.class);
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+            throw new AssertionError(e.getMessage());
+        }
+
+        try {
+            this.abstractScriptEngineClass.asSubclass(java.lang.Void.class);
+            throw new AssertionError("Class.asSubclass(java.lang.Void.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.asSubclass(java.lang.Number.class);
+            throw new AssertionError("Class.asSubclass(java.lang.Number.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.asSubclass(java.lang.Byte.class);
+            throw new AssertionError("Class.asSubclass(java.lang.Byte.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.asSubclass(java.lang.Double.class);
+            throw new AssertionError("Class.asSubclass(java.lang.Double.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.asSubclass(java.lang.Float.class);
+            throw new AssertionError("Class.asSubclass(java.lang.Float.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.asSubclass(java.lang.Integer.class);
+            throw new AssertionError("Class.asSubclass(java.lang.Integer.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.asSubclass(java.lang.Long.class);
+            throw new AssertionError("Class.asSubclass(java.lang.Long.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.asSubclass(java.lang.Short.class);
+            throw new AssertionError("Class.asSubclass(java.lang.Short.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.asSubclass(java.lang.String.class);
+            throw new AssertionError("Class.asSubclass(java.lang.String.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.asSubclass(java.lang.StringBuffer.class);
+            throw new AssertionError("Class.asSubclass(java.lang.StringBuffer.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.asSubclass(java.lang.StringBuilder.class);
+            throw new AssertionError("Class.asSubclass(java.lang.StringBuilder.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.asSubclass(java.awt.Color.class);
+            throw new AssertionError("Class.asSubclass(java.awt.Color.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.asSubclass(java.awt.Font.class);
+            throw new AssertionError("Class.asSubclass(java.awt.Font.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.asSubclass(java.awt.Image.class);
+            throw new AssertionError("Class.asSubclass(java.awt.Image.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.asSubclass(javax.swing.JPanel.class);
+            throw new AssertionError("Class.asSubclass(javax.swing.JPanel.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.asSubclass(javax.swing.JColorChooser.class);
+            throw new AssertionError("Class.asSubclass(javax.swing.JColorChooser.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.asSubclass(javax.swing.JScrollBar.class);
+            throw new AssertionError("Class.asSubclass(javax.swing.JScrollBar.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.asSubclass(javax.swing.JSlider.class);
+            throw new AssertionError("Class.asSubclass(javax.swing.JSlider.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+    }
+
+    /**
      * Test for instanceof operator applied to a class javax.script.AbstractScriptEngine
      */
     @SuppressWarnings("cast")