[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-distro-pkg-dev
Subject:    /hg/rhino-tests: Added new test testCast (that checks Class.cast...
From:       ptisnovs () icedtea ! classpath ! org
Date:       2013-08-30 9:27:38
Message-ID: hg.e55f8607a4cf.1377854858.-6019694633368342460 () icedtea ! classpath ! org
[Download RAW message or body]

changeset e55f8607a4cf in /hg/rhino-tests
details: http://icedtea.classpath.org/hg/rhino-tests?cmd=changeset;node=e55f8607a4cf
author: Pavel Tisnovsky <ptisnovs@redhat.com>
date: Fri Aug 30 11:30:45 2013 +0200

	Added new test testCast (that checks Class.cast() method) into test
	test suite AbstractScriptEngineClassTest.


diffstat:

 ChangeLog                                             |    6 +
 src/org/RhinoTests/AbstractScriptEngineClassTest.java |  190 ++++++++++++++++++
 2 files changed, 196 insertions(+), 0 deletions(-)

diffs (213 lines):

diff -r e89e9eb83631 -r e55f8607a4cf ChangeLog
--- a/ChangeLog	Thu Aug 29 11:22:40 2013 +0200
+++ b/ChangeLog	Fri Aug 30 11:30:45 2013 +0200
@@ -1,3 +1,9 @@
+2013-08-30  Pavel Tisnovsky  <ptisnovs@redhat.com>
+
+	* src/org/RhinoTests/AbstractScriptEngineClassTest.java:
+	Added new test testCast (that checks Class.cast() method) into test
+	test suite AbstractScriptEngineClassTest.
+
 2013-08-29  Pavel Tisnovsky  <ptisnovs@redhat.com>
 
 	* src/org/RhinoTests/InvocableClassTest.java:
diff -r e89e9eb83631 -r e55f8607a4cf \
                src/org/RhinoTests/AbstractScriptEngineClassTest.java
--- a/src/org/RhinoTests/AbstractScriptEngineClassTest.java	Thu Aug 29 11:22:40 2013 \
                +0200
+++ b/src/org/RhinoTests/AbstractScriptEngineClassTest.java	Fri Aug 30 11:30:45 2013 \
+0200 @@ -1487,6 +1487,196 @@
     }
 
     /**
+     * Test for method javax.script.AbstractScriptEngine.getClass().cast()
+     */
+    protected void testCast() {
+        try {
+            this.abstractScriptEngineClass.cast(new Object());
+            throw new AssertionError("Class.cast(new Object()) does not throw any \
exception"); +        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.cast(new Object().getClass());
+            throw new AssertionError("Class.cast(new Object().getClass()) does not \
throw any exception"); +        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.cast(new String());
+            throw new AssertionError("Class.cast(new String()) does not throw any \
exception"); +        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.cast(Boolean.valueOf(true));
+            throw new AssertionError("Class.cast(Boolean.valueOf(true)) does not \
throw any exception"); +        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.cast(Boolean.valueOf(false));
+            throw new AssertionError("Class.cast(Boolean.valueOf(false)) does not \
throw any exception"); +        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.cast(Byte.valueOf((byte)42));
+            throw new AssertionError("Class.cast(Byte.valueOf((byte)42)) does not \
throw any exception"); +        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.cast(Short.valueOf((short)42));
+            throw new AssertionError("Class.cast(Short.valueOf((short)42)) does not \
throw any exception"); +        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.cast(Integer.valueOf(42));
+            throw new AssertionError("Class.cast(Integer.valueOf(42)) does not throw \
any exception"); +        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.cast(Long.valueOf(42L));
+            throw new AssertionError("Class.cast(Long.valueOf(42L)) does not throw \
any exception"); +        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.cast(Float.valueOf(42f));
+            throw new AssertionError("Class.cast(Float.valueOf(42f)) does not throw \
any exception"); +        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.cast(Double.valueOf(42.));
+            throw new AssertionError("Class.cast(Double.valueOf(42.)) does not throw \
any exception"); +        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.cast(new Throwable());
+            throw new AssertionError("Class.cast(new Throwable()) does not throw any \
exception"); +        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.cast(new RuntimeException());
+            throw new AssertionError("Class.cast(new RuntimeException()) does not \
throw any exception"); +        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.cast(new Error());
+            throw new AssertionError("Class.cast(new Error()) does not throw any \
exception"); +        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.cast(new java.lang.String());
+            throw new AssertionError("Class.cast(new java.lang.String()) does not \
throw any exception"); +        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.cast(new java.lang.StringBuffer());
+            throw new AssertionError("Class.cast(new java.lang.StringBuffer()) does \
not throw any exception"); +        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.cast(new java.lang.StringBuilder());
+            throw new AssertionError("Class.cast(new java.lang.StringBuilder()) does \
not throw any exception"); +        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.cast(java.awt.Color.black);
+            throw new AssertionError("Class.cast(java.awt.Color.black) does not \
throw any exception"); +        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.cast(new java.awt.Frame());
+            throw new AssertionError("Class.cast(new java.awt.Frame()) does not \
throw any exception"); +        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.cast(new java.awt.Frame(new String()));
+            throw new AssertionError("Class.cast(new java.awt.Frame(new String())) \
does not throw any exception"); +        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.cast(new javax.swing.JLabel());
+            throw new AssertionError("Class.cast(new javax.swing.JLabel()) does not \
throw any exception"); +        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.cast(new javax.swing.JLabel(new \
String())); +            throw new AssertionError("Class.cast(new \
javax.swing.JLabel(new String())) does not throw any exception"); +        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+        try {
+            this.abstractScriptEngineClass.cast(new javax.swing.JPanel());
+            throw new AssertionError("Class.cast(new javax.swing.JPanel()) does not \
throw any exception"); +        }
+        catch (Exception e) {
+            // expected exception
+        }
+
+    }
+
+    /**
      * Test for instanceof operator applied to a class \
                javax.script.AbstractScriptEngine
      */
     @SuppressWarnings("cast")


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic