/hg/rhino-tests: Added new test testCast (that checks Class.cast...
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Tue Sep 3 01:09:56 PDT 2013
changeset 242771777388 in /hg/rhino-tests
details: http://icedtea.classpath.org/hg/rhino-tests?cmd=changeset;node=242771777388
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Tue Sep 03 10:13:38 2013 +0200
Added new test testCast (that checks Class.cast() method) into test
test suite SimpleBindingsClassTest.
diffstat:
ChangeLog | 6 +
src/org/RhinoTests/SimpleBindingsClassTest.java | 198 ++++++++++++++++++++++++
2 files changed, 204 insertions(+), 0 deletions(-)
diffs (221 lines):
diff -r e5840a2853aa -r 242771777388 ChangeLog
--- a/ChangeLog Mon Sep 02 11:55:15 2013 +0200
+++ b/ChangeLog Tue Sep 03 10:13:38 2013 +0200
@@ -1,3 +1,9 @@
+2013-09-03 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * src/org/RhinoTests/SimpleBindingsClassTest.java:
+ Added new test testCast (that checks Class.cast() method) into test
+ test suite SimpleBindingsClassTest.
+
2013-09-02 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/RhinoTests/SimpleScriptContextClassTest.java:
diff -r e5840a2853aa -r 242771777388 src/org/RhinoTests/SimpleBindingsClassTest.java
--- a/src/org/RhinoTests/SimpleBindingsClassTest.java Mon Sep 02 11:55:15 2013 +0200
+++ b/src/org/RhinoTests/SimpleBindingsClassTest.java Tue Sep 03 10:13:38 2013 +0200
@@ -1288,6 +1288,204 @@
}
/**
+ * Test for method javax.script.SimpleBindings.getClass().cast()
+ */
+ protected void testCast() {
+ try {
+ this.simpleBindingsClass.cast(new javax.script.SimpleBindings());
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ throw new AssertionError(e.getMessage());
+ }
+
+ try {
+ this.simpleBindingsClass.cast(new Object());
+ throw new AssertionError("Class.cast(new Object()) does not throw any exception");
+ }
+ catch (Exception e) {
+ // expected exception
+ }
+
+ try {
+ this.simpleBindingsClass.cast(new Object().getClass());
+ throw new AssertionError("Class.cast(new Object().getClass()) does not throw any exception");
+ }
+ catch (Exception e) {
+ // expected exception
+ }
+
+ try {
+ this.simpleBindingsClass.cast(new String());
+ throw new AssertionError("Class.cast(new String()) does not throw any exception");
+ }
+ catch (Exception e) {
+ // expected exception
+ }
+
+ try {
+ this.simpleBindingsClass.cast(Boolean.valueOf(true));
+ throw new AssertionError("Class.cast(Boolean.valueOf(true)) does not throw any exception");
+ }
+ catch (Exception e) {
+ // expected exception
+ }
+
+ try {
+ this.simpleBindingsClass.cast(Boolean.valueOf(false));
+ throw new AssertionError("Class.cast(Boolean.valueOf(false)) does not throw any exception");
+ }
+ catch (Exception e) {
+ // expected exception
+ }
+
+ try {
+ this.simpleBindingsClass.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.simpleBindingsClass.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.simpleBindingsClass.cast(Integer.valueOf(42));
+ throw new AssertionError("Class.cast(Integer.valueOf(42)) does not throw any exception");
+ }
+ catch (Exception e) {
+ // expected exception
+ }
+
+ try {
+ this.simpleBindingsClass.cast(Long.valueOf(42L));
+ throw new AssertionError("Class.cast(Long.valueOf(42L)) does not throw any exception");
+ }
+ catch (Exception e) {
+ // expected exception
+ }
+
+ try {
+ this.simpleBindingsClass.cast(Float.valueOf(42f));
+ throw new AssertionError("Class.cast(Float.valueOf(42f)) does not throw any exception");
+ }
+ catch (Exception e) {
+ // expected exception
+ }
+
+ try {
+ this.simpleBindingsClass.cast(Double.valueOf(42.));
+ throw new AssertionError("Class.cast(Double.valueOf(42.)) does not throw any exception");
+ }
+ catch (Exception e) {
+ // expected exception
+ }
+
+ try {
+ this.simpleBindingsClass.cast(new Throwable());
+ throw new AssertionError("Class.cast(new Throwable()) does not throw any exception");
+ }
+ catch (Exception e) {
+ // expected exception
+ }
+
+ try {
+ this.simpleBindingsClass.cast(new RuntimeException());
+ throw new AssertionError("Class.cast(new RuntimeException()) does not throw any exception");
+ }
+ catch (Exception e) {
+ // expected exception
+ }
+
+ try {
+ this.simpleBindingsClass.cast(new Error());
+ throw new AssertionError("Class.cast(new Error()) does not throw any exception");
+ }
+ catch (Exception e) {
+ // expected exception
+ }
+
+ try {
+ this.simpleBindingsClass.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.simpleBindingsClass.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.simpleBindingsClass.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.simpleBindingsClass.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.simpleBindingsClass.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.simpleBindingsClass.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.simpleBindingsClass.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.simpleBindingsClass.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.simpleBindingsClass.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.SimpleBindings
*/
@SuppressWarnings("cast")
More information about the distro-pkg-dev
mailing list