changeset 315:231f67d488ce draft

Added new test cases into CompilableClassTest.
author Pavel Tisnovsky <ptisnovs@redhat.com>
date Fri, 07 Feb 2014 11:55:30 +0100
parents fd15e637f069
children 077763ca95bf
files ChangeLog src/org/RhinoTests/CompilableClassTest.java
diffstat 2 files changed, 77 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Feb 06 13:11:10 2014 +0100
+++ b/ChangeLog	Fri Feb 07 11:55:30 2014 +0100
@@ -1,3 +1,8 @@
+2014-02-07  Pavel Tisnovsky  <ptisnovs@redhat.com>
+
+	* src/org/RhinoTests/CompilableClassTest.java:
+	Added new test cases into CompilableClassTest.
+
 2014-02-06  Pavel Tisnovsky  <ptisnovs@redhat.com>
 
 	* src/org/RhinoTests/ScriptContextClassTest.java:
--- a/src/org/RhinoTests/CompilableClassTest.java	Thu Feb 06 13:11:10 2014 +0100
+++ b/src/org/RhinoTests/CompilableClassTest.java	Fri Feb 07 11:55:30 2014 +0100
@@ -1506,6 +1506,14 @@
         }
 
         try {
+            this.compilableClass.cast(Character.valueOf('a'));
+            throw new AssertionError("Class.cast(Character.valueOf('a')) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
             this.compilableClass.cast(Byte.valueOf((byte)42));
             throw new AssertionError("Class.cast(Byte.valueOf((byte)42)) does not throw any exception");
         }
@@ -1562,6 +1570,14 @@
         }
 
         try {
+            this.compilableClass.cast(new Throwable("xyzzy"));
+            throw new AssertionError("Class.cast(new Throwable(\"xyzzy\")) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
             this.compilableClass.cast(new RuntimeException());
             throw new AssertionError("Class.cast(new RuntimeException()) does not throw any exception");
         }
@@ -1570,6 +1586,14 @@
         }
 
         try {
+            this.compilableClass.cast(new RuntimeException("xyzzy"));
+            throw new AssertionError("Class.cast(new RuntimeException(\"xyzzy\")) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
             this.compilableClass.cast(new Error());
             throw new AssertionError("Class.cast(new Error()) does not throw any exception");
         }
@@ -1578,6 +1602,22 @@
         }
 
         try {
+            this.compilableClass.cast(new Error("xyzzy"));
+            throw new AssertionError("Class.cast(new Error(\"xyzzy\")) does not throw any exception");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.compilableClass.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.compilableClass.cast(new java.lang.String());
             throw new AssertionError("Class.cast(new java.lang.String()) does not throw any exception");
         }
@@ -1626,6 +1666,30 @@
         }
 
         try {
+            this.compilableClass.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.compilableClass.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.compilableClass.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.compilableClass.cast(new javax.swing.JLabel());
             throw new AssertionError("Class.cast(new javax.swing.JLabel()) does not throw any exception");
         }
@@ -1642,6 +1706,14 @@
         }
 
         try {
+            this.compilableClass.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.compilableClass.cast(new javax.swing.JPanel());
             throw new AssertionError("Class.cast(new javax.swing.JPanel()) does not throw any exception");
         }