changeset 307:d6b53a234aca draft

More test improvements.
author Pavel Tisnovsky <ptisnovs@redhat.com>
date Fri, 24 Jan 2014 14:14:19 +0100
parents ec46202571e9
children eb150896a385
files ChangeLog src/org/RhinoTests/SimpleScriptContextClassTest.java
diffstat 2 files changed, 55 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Jan 23 13:27:15 2014 +0100
+++ b/ChangeLog	Fri Jan 24 14:14:19 2014 +0100
@@ -1,3 +1,8 @@
+2014-01-24  Pavel Tisnovsky  <ptisnovs@redhat.com>
+
+	* src/org/RhinoTests/SimpleScriptContextClassTest.java:
+	More test improvements.
+
 2014-01-23  Pavel Tisnovsky  <ptisnovs@redhat.com>
 
 	* src/org/RhinoTests/SimpleScriptContextClassTest.java:
--- a/src/org/RhinoTests/SimpleScriptContextClassTest.java	Thu Jan 23 13:27:15 2014 +0100
+++ b/src/org/RhinoTests/SimpleScriptContextClassTest.java	Fri Jan 24 14:14:19 2014 +0100
@@ -1962,6 +1962,30 @@
         }
 
         try {
+            this.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.cast(new javax.swing.JLabel());
             throw new AssertionError("Class.cast(new javax.swing.JLabel()) does not throw any exception");
         }
@@ -1978,6 +2002,14 @@
         }
 
         try {
+            this.simpleScriptContextClass.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.simpleScriptContextClass.cast(new javax.swing.JPanel());
             throw new AssertionError("Class.cast(new javax.swing.JPanel()) does not throw any exception");
         }
@@ -2162,6 +2194,24 @@
     }
 
     /**
+     * Test for method javax.script.SimpleScriptContext.getClass().getResourceAsStreamPositiveTest()
+     */
+    protected void testGetResourceAsStreamPositiveTest() {
+        Object stream;
+        stream = this.simpleScriptContextClass.getResourceAsStream("/org/RhinoTests/AbstractScriptEngineClassTest.class");
+        assertNotNull(stream, "getResourceAsStream(\"/org/RhinoTests/AbstractScriptEngineClassTest.class\") returns null");
+    }
+
+    /**
+     * Test for method javax.script.SimpleScriptContext.getClass().toString()
+     */
+    protected void testToString() {
+        String asString;
+        asString = this.simpleScriptContextClass.toString();
+        assertEquals("class javax.script.SimpleScriptContext", asString, "wrong toString() return value");
+    }
+
+    /**
      * Test for instanceof operator applied to a class javax.script.SimpleScriptContext
      */
     @SuppressWarnings("cast")