changeset 323:4dee1c9a9f58 draft

Enhancements of various tests in ScriptEngineClassTest.
author Pavel Tisnovsky <ptisnovs@redhat.com>
date Wed, 26 Feb 2014 11:39:25 +0100
parents cd4f00d779f7
children ab31415af980
files ChangeLog src/org/RhinoTests/ScriptEngineClassTest.java
diffstat 2 files changed, 254 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Feb 25 11:03:31 2014 +0100
+++ b/ChangeLog	Wed Feb 26 11:39:25 2014 +0100
@@ -1,3 +1,8 @@
+2014-02-26  Pavel Tisnovsky  <ptisnovs@redhat.com>
+
+	* src/org/RhinoTests/ScriptEngineClassTest.java:
+	Enhancements of various tests in ScriptEngineClassTest.
+
 2014-02-25  Pavel Tisnovsky  <ptisnovs@redhat.com>
 
 	* src/org/RhinoTests/InvocableClassTest.java:
--- a/src/org/RhinoTests/ScriptEngineClassTest.java	Tue Feb 25 11:03:31 2014 +0100
+++ b/src/org/RhinoTests/ScriptEngineClassTest.java	Wed Feb 26 11:39:25 2014 +0100
@@ -1,7 +1,7 @@
 /*
   Rhino test framework
 
-   Copyright (C) 2011, 2012, 2013  Red Hat
+   Copyright (C) 2011, 2012, 2013, 2014  Red Hat
 
 This file is part of IcedTea.
 
@@ -1445,6 +1445,214 @@
         }
 
         try {
+            this.scriptEngineClass.asSubclass(java.awt.Label.class);
+            throw new AssertionError("Class.asSubclass(java.awt.Label.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.scriptEngineClass.asSubclass(java.awt.List.class);
+            throw new AssertionError("Class.asSubclass(java.awt.List.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.scriptEngineClass.asSubclass(java.awt.Menu.class);
+            throw new AssertionError("Class.asSubclass(java.awt.Menu.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.scriptEngineClass.asSubclass(java.io.File.class);
+            throw new AssertionError("Class.asSubclass(java.io.File.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.scriptEngineClass.asSubclass(java.io.Reader.class);
+            throw new AssertionError("Class.asSubclass(java.io.Reader.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.scriptEngineClass.asSubclass(java.io.Writer.class);
+            throw new AssertionError("Class.asSubclass(java.io.Writer.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.scriptEngineClass.asSubclass(java.io.StringReader.class);
+            throw new AssertionError("Class.asSubclass(java.io.StringReader.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.scriptEngineClass.asSubclass(java.io.StringWriter.class);
+            throw new AssertionError("Class.asSubclass(java.io.StringWriter.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.scriptEngineClass.asSubclass(java.io.InputStream.class);
+            throw new AssertionError("Class.asSubclass(java.io.InputStream.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.scriptEngineClass.asSubclass(java.io.OutputStream.class);
+            throw new AssertionError("Class.asSubclass(java.io.OutputStream.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.scriptEngineClass.asSubclass(java.io.ObjectInputStream.class);
+            throw new AssertionError("Class.asSubclass(java.io.ObjectInputStream.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.scriptEngineClass.asSubclass(java.io.ObjectOutputStream.class);
+            throw new AssertionError("Class.asSubclass(java.io.ObjectOutputStream.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.scriptEngineClass.asSubclass(java.math.BigDecimal.class);
+            throw new AssertionError("Class.asSubclass(java.math.BigDecimal.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.scriptEngineClass.asSubclass(java.math.BigInteger.class);
+            throw new AssertionError("Class.asSubclass(java.math.BigInteger.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.scriptEngineClass.asSubclass(java.util.ArrayList.class);
+            throw new AssertionError("Class.asSubclass(java.util.ArrayList.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.scriptEngineClass.asSubclass(java.util.LinkedList.class);
+            throw new AssertionError("Class.asSubclass(java.util.LinkedList.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.scriptEngineClass.asSubclass(java.util.HashMap.class);
+            throw new AssertionError("Class.asSubclass(java.util.HashMap.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.scriptEngineClass.asSubclass(java.util.TreeMap.class);
+            throw new AssertionError("Class.asSubclass(java.util.TreeMap.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.scriptEngineClass.asSubclass(java.util.HashSet.class);
+            throw new AssertionError("Class.asSubclass(java.util.HashSet.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.scriptEngineClass.asSubclass(java.util.TreeSet.class);
+            throw new AssertionError("Class.asSubclass(java.util.TreeSet.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.scriptEngineClass.asSubclass(java.util.Stack.class);
+            throw new AssertionError("Class.asSubclass(java.util.Stack.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.scriptEngineClass.asSubclass(java.util.Vector.class);
+            throw new AssertionError("Class.asSubclass(java.util.Vector.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.scriptEngineClass.asSubclass(java.util.Hashtable.class);
+            throw new AssertionError("Class.asSubclass(java.util.Hashtable.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.scriptEngineClass.asSubclass(java.util.Calendar.class);
+            throw new AssertionError("Class.asSubclass(java.util.Calendar.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.scriptEngineClass.asSubclass(java.util.Arrays.class);
+            throw new AssertionError("Class.asSubclass(java.util.Arrays.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.scriptEngineClass.asSubclass(java.util.Collections.class);
+            throw new AssertionError("Class.asSubclass(java.util.Collections.class) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
             this.scriptEngineClass.asSubclass(javax.swing.JPanel.class);
             throw new AssertionError("Class.asSubclass(javax.swing.JPanel.class) does not throw any exception");
         }
@@ -1523,6 +1731,14 @@
         }
 
         try {
+            this.scriptEngineClass.cast(Character.valueOf('a'));
+            throw new AssertionError("Class.cast(Character.valueOf('a')) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
             this.scriptEngineClass.cast(Byte.valueOf((byte)42));
             throw new AssertionError("Class.cast(Byte.valueOf((byte)42)) does not throw any exception");
         }
@@ -1579,6 +1795,14 @@
         }
 
         try {
+            this.scriptEngineClass.cast(new Throwable("xyzzy"));
+            throw new AssertionError("Class.cast(new Throwable(\"xyzzy\")) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
             this.scriptEngineClass.cast(new RuntimeException());
             throw new AssertionError("Class.cast(new RuntimeException()) does not throw any exception");
         }
@@ -1587,6 +1811,14 @@
         }
 
         try {
+            this.scriptEngineClass.cast(new RuntimeException("xyzzy"));
+            throw new AssertionError("Class.cast(new RuntimeException(\"xyzzy\")) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
             this.scriptEngineClass.cast(new Error());
             throw new AssertionError("Class.cast(new Error()) does not throw any exception");
         }
@@ -1595,6 +1827,22 @@
         }
 
         try {
+            this.scriptEngineClass.cast(new Error("xyzzy"));
+            throw new AssertionError("Class.cast(new Error(\"xyzzy\")) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.scriptEngineClass.cast(new java.io.File("xyzzy"));
+            throw new AssertionError("Class.cast(new java.io.File(\"xyzzy\")) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
             this.scriptEngineClass.cast(new java.lang.String());
             throw new AssertionError("Class.cast(new java.lang.String()) does not throw any exception");
         }