/hg/rhino-tests: Added new test testAsSubclass into the test suite

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Wed Sep 18 02:38:43 PDT 2013


changeset 2e5f4bdb4931 in /hg/rhino-tests
details: http://icedtea.classpath.org/hg/rhino-tests?cmd=changeset;node=2e5f4bdb4931
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Wed Sep 18 11:42:31 2013 +0200

	Added new test testAsSubclass into the test suite
	ScriptExceptionClassTest.


diffstat:

 ChangeLog                                        |    8 +-
 src/org/RhinoTests/ScriptExceptionClassTest.java |  118 +++++++++++++++++++++++
 2 files changed, 125 insertions(+), 1 deletions(-)

diffs (147 lines):

diff -r 12f27742973a -r 2e5f4bdb4931 ChangeLog
--- a/ChangeLog	Tue Sep 17 11:31:40 2013 +0200
+++ b/ChangeLog	Wed Sep 18 11:42:31 2013 +0200
@@ -1,8 +1,14 @@
+2013-09-18  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/RhinoTests/ScriptExceptionClassTest.java:
+	Added new test testAsSubclass into the test suite
+	ScriptExceptionClassTest.
+
 2013-09-17  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/org/RhinoTests/CompilableClassTest.java:
 	Added new test testNewInstance into the test suite
-	BindingsClassTest.
+	CompilableClassTest.
 
 2013-09-16  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
diff -r 12f27742973a -r 2e5f4bdb4931 src/org/RhinoTests/ScriptExceptionClassTest.java
--- a/src/org/RhinoTests/ScriptExceptionClassTest.java	Tue Sep 17 11:31:40 2013 +0200
+++ b/src/org/RhinoTests/ScriptExceptionClassTest.java	Wed Sep 18 11:42:31 2013 +0200
@@ -1266,6 +1266,124 @@
     }
 
     /**
+     * Test for method javax.script.ScriptException.getClass().asSubclass()
+     */
+    protected void testAsSubclass() {
+        try {
+            this.scriptExceptionClass.asSubclass(scriptExceptionClass);
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+            throw new AssertionError(e.getMessage());
+        }
+
+        try {
+            this.scriptExceptionClass.asSubclass(Exception.class);
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+            throw new AssertionError(e.getMessage());
+        }
+
+        try {
+            this.scriptExceptionClass.asSubclass(Throwable.class);
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+            throw new AssertionError(e.getMessage());
+        }
+
+        try {
+            this.scriptExceptionClass.asSubclass(Object.class);
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+            throw new AssertionError(e.getMessage());
+        }
+
+        try {
+            this.scriptExceptionClass.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.scriptExceptionClass.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.scriptExceptionClass.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.scriptExceptionClass.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.scriptExceptionClass.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.scriptExceptionClass.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.scriptExceptionClass.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.scriptExceptionClass.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.scriptExceptionClass.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.scriptExceptionClass.asSubclass(java.awt.Font.class);
+            throw new AssertionError("Class.asSubclass(java.awt.Font.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+    }
+
+    /**
      * Test for instanceof operator applied to a class javax.script.ScriptException
      */
     @SuppressWarnings("cast")



More information about the distro-pkg-dev mailing list