changeset 252:91022c9f48b3 draft

Added new test testAsSubclass into the test suite ScriptEngineManagerClassTest.
author Pavel Tisnovsky <ptisnovs@redhat.com>
date Mon, 14 Oct 2013 11:51:07 +0200
parents 00b968a159d4
children c1cc99b637bf
files ChangeLog src/org/RhinoTests/ScriptEngineManagerClassTest.java
diffstat 2 files changed, 175 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Oct 11 10:20:55 2013 +0200
+++ b/ChangeLog	Mon Oct 14 11:51:07 2013 +0200
@@ -1,7 +1,13 @@
+2013-10-14  Pavel Tisnovsky  <ptisnovs@redhat.com>
+
+	* src/org/RhinoTests/ScriptEngineManagerClassTest.java:
+	Added new test testAsSubclass into the
+	test suite ScriptEngineManagerClassTest.
+
 2013-10-11  Pavel Tisnovsky  <ptisnovs@redhat.com>
 
 	* src/org/RhinoTests/ScriptEngineManagerClassTest.java:
-	Added new test testCast (that checks Class.cast() method) into test
+	Added new test testCast (that checks Class.cast() method) into the
 	test suite ScriptEngineManagerClassTest.
 
 2013-10-10  Pavel Tisnovsky  <ptisnovs@redhat.com>
@@ -13,13 +19,13 @@
 2013-10-09  Pavel Tisnovsky  <ptisnovs@redhat.com>
 
 	* src/org/RhinoTests/ScriptExceptionClassTest.java:
-	Added new test testCast (that checks Class.cast() method) into test
+	Added new test testCast (that checks Class.cast() method) into the
 	test suite ScriptExceptionClassTest.
 
 2013-10-08  Pavel Tisnovsky  <ptisnovs@redhat.com>
 
 	* src/org/RhinoTests/ScriptEngineFactoryClassTest.java:
-	Added new test testCast (that checks Class.cast() method) into test
+	Added new test testCast (that checks Class.cast() method) into the
 	test suite ScriptEngineFactoryClassTest.
 
 2013-10-07  Pavel Tisnovsky  <ptisnovs@redhat.com>
--- a/src/org/RhinoTests/ScriptEngineManagerClassTest.java	Fri Oct 11 10:20:55 2013 +0200
+++ b/src/org/RhinoTests/ScriptEngineManagerClassTest.java	Mon Oct 14 11:51:07 2013 +0200
@@ -1316,6 +1316,172 @@
     }
 
     /**
+     * Test for method javax.script.ScriptEngineManager.getClass().asSubclass()
+     */
+    protected void testAsSubclass() {
+        try {
+            this.scriptEngineManagerClass.asSubclass(scriptEngineManagerClass);
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+            throw new AssertionError(e.getMessage());
+        }
+
+        try {
+            this.scriptEngineManagerClass.asSubclass(Object.class);
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+            throw new AssertionError(e.getMessage());
+        }
+
+        try {
+            this.scriptEngineManagerClass.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.scriptEngineManagerClass.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.scriptEngineManagerClass.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.scriptEngineManagerClass.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.scriptEngineManagerClass.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.scriptEngineManagerClass.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.scriptEngineManagerClass.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.scriptEngineManagerClass.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.scriptEngineManagerClass.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.scriptEngineManagerClass.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.scriptEngineManagerClass.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.scriptEngineManagerClass.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.scriptEngineManagerClass.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.scriptEngineManagerClass.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.scriptEngineManagerClass.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.scriptEngineManagerClass.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.scriptEngineManagerClass.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.scriptEngineManagerClass.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 method javax.script.ScriptEngineManager.getClass().cast()
      */
     protected void testCast() {