changeset 332:7a653bbdeeec draft

Enhancements of various tests in ScriptEngineFactoryClassTest.
author Pavel Tisnovsky <ptisnovs@redhat.com>
date Thu, 13 Mar 2014 09:50:36 +0100
parents bdfcaa390fb9
children 39b90cb1bd47
files ChangeLog src/org/RhinoTests/ScriptEngineFactoryClassTest.java
diffstat 2 files changed, 77 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Mar 12 12:42:16 2014 +0100
+++ b/ChangeLog	Thu Mar 13 09:50:36 2014 +0100
@@ -1,3 +1,8 @@
+2014-03-13  Pavel Tisnovsky  <ptisnovs@redhat.com>
+
+	* src/org/RhinoTests/ScriptEngineFactoryClassTest.java:
+	Enhancements of various tests in ScriptEngineFactoryClassTest.
+
 2014-03-12  Pavel Tisnovsky  <ptisnovs@redhat.com>
 
 	* src/org/RhinoTests/InvocableClassTest.java:
--- a/src/org/RhinoTests/ScriptEngineFactoryClassTest.java	Wed Mar 12 12:42:16 2014 +0100
+++ b/src/org/RhinoTests/ScriptEngineFactoryClassTest.java	Thu Mar 13 09:50:36 2014 +0100
@@ -1624,6 +1624,14 @@
         }
 
         try {
+            this.scriptEngineFactoryClass.cast(Character.valueOf('a'));
+            throw new AssertionError("Class.cast(Character.valueOf('a')) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
             this.scriptEngineFactoryClass.cast(Byte.valueOf((byte)42));
             throw new AssertionError("Class.cast(Byte.valueOf((byte)42)) does not throw any exception");
         }
@@ -1680,6 +1688,14 @@
         }
 
         try {
+            this.scriptEngineFactoryClass.cast(new Throwable("xyzzy"));
+            throw new AssertionError("Class.cast(new Throwable(\"xyzzy\")) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
             this.scriptEngineFactoryClass.cast(new RuntimeException());
             throw new AssertionError("Class.cast(new RuntimeException()) does not throw any exception");
         }
@@ -1688,6 +1704,14 @@
         }
 
         try {
+            this.scriptEngineFactoryClass.cast(new RuntimeException("xyzzy"));
+            throw new AssertionError("Class.cast(new RuntimeException(\"xyzzy\")) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
             this.scriptEngineFactoryClass.cast(new Error());
             throw new AssertionError("Class.cast(new Error()) does not throw any exception");
         }
@@ -1696,6 +1720,22 @@
         }
 
         try {
+            this.scriptEngineFactoryClass.cast(new Error("xyzzy"));
+            throw new AssertionError("Class.cast(new Error(\"xyzzy\")) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.scriptEngineFactoryClass.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.scriptEngineFactoryClass.cast(new java.lang.String());
             throw new AssertionError("Class.cast(new java.lang.String()) does not throw any exception");
         }
@@ -1744,6 +1784,30 @@
         }
 
         try {
+            this.scriptEngineFactoryClass.cast(new java.awt.Label());
+            throw new AssertionError("Class.cast(new java.awt.Label()) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.scriptEngineFactoryClass.cast(new java.awt.Label(new String()));
+            throw new AssertionError("Class.cast(new java.awt.Label(new String())) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.scriptEngineFactoryClass.cast(new java.awt.Label("xyzzy"));
+            throw new AssertionError("Class.cast(new java.awt.Label(\"xyzzy\")) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
             this.scriptEngineFactoryClass.cast(new javax.swing.JLabel());
             throw new AssertionError("Class.cast(new javax.swing.JLabel()) does not throw any exception");
         }
@@ -1760,6 +1824,14 @@
         }
 
         try {
+            this.scriptEngineFactoryClass.cast(new javax.swing.JLabel("xyzzy"));
+            throw new AssertionError("Class.cast(new javax.swing.JLabel(\"xyzzy\")) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
             this.scriptEngineFactoryClass.cast(new javax.swing.JPanel());
             throw new AssertionError("Class.cast(new javax.swing.JPanel()) does not throw any exception");
         }