Mercurial > hg > rhino-tests
changeset 242:8055f8294f0e draft
Added new test testAsSubclass into the test suite
ScriptEngineClassTest.
author | Pavel Tisnovsky <ptisnovs@redhat.com> |
---|---|
date | Mon, 30 Sep 2013 08:55:31 +0200 |
parents | 1bdd275b1a8d |
children | fbd651803006 |
files | ChangeLog src/org/RhinoTests/ScriptEngineClassTest.java |
diffstat | 2 files changed, 164 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Fri Sep 27 09:45:37 2013 +0200 +++ b/ChangeLog Mon Sep 30 08:55:31 2013 +0200 @@ -1,3 +1,9 @@ +2013-09-30 Pavel Tisnovsky <ptisnovs@redhat.com> + + * src/org/RhinoTests/ScriptEngineClassTest.java: + Added new test testAsSubclass into the test suite + ScriptEngineClassTest. + 2013-09-27 Pavel Tisnovsky <ptisnovs@redhat.com> * src/org/RhinoTests/ScriptExceptionClassTest.java:
--- a/src/org/RhinoTests/ScriptEngineClassTest.java Fri Sep 27 09:45:37 2013 +0200 +++ b/src/org/RhinoTests/ScriptEngineClassTest.java Mon Sep 30 08:55:31 2013 +0200 @@ -1273,6 +1273,164 @@ } /** + * Test for method javax.script.ScriptEngine.getClass().asSubclass() + */ + protected void testAsSubclass() { + try { + this.scriptEngineClass.asSubclass(scriptEngineClass); + } + catch (Exception e) { + e.printStackTrace(); + throw new AssertionError(e.getMessage()); + } + + try { + this.scriptEngineClass.asSubclass(java.lang.Void.class); + throw new AssertionError("Class.asSubclass(java.lang.Void.class) does not throw any exception"); + } + catch (Exception e) { + // expected exception + } + + try { + this.scriptEngineClass.asSubclass(java.lang.Number.class); + throw new AssertionError("Class.asSubclass(java.lang.Number.class) does not throw any exception"); + } + catch (Exception e) { + // expected exception + } + + try { + this.scriptEngineClass.asSubclass(java.lang.Byte.class); + throw new AssertionError("Class.asSubclass(java.lang.Byte.class) does not throw any exception"); + } + catch (Exception e) { + // expected exception + } + + try { + this.scriptEngineClass.asSubclass(java.lang.Double.class); + throw new AssertionError("Class.asSubclass(java.lang.Double.class) does not throw any exception"); + } + catch (Exception e) { + // expected exception + } + + try { + this.scriptEngineClass.asSubclass(java.lang.Float.class); + throw new AssertionError("Class.asSubclass(java.lang.Float.class) does not throw any exception"); + } + catch (Exception e) { + // expected exception + } + + try { + this.scriptEngineClass.asSubclass(java.lang.Integer.class); + throw new AssertionError("Class.asSubclass(java.lang.Integer.class) does not throw any exception"); + } + catch (Exception e) { + // expected exception + } + + try { + this.scriptEngineClass.asSubclass(java.lang.Long.class); + throw new AssertionError("Class.asSubclass(java.lang.Long.class) does not throw any exception"); + } + catch (Exception e) { + // expected exception + } + + try { + this.scriptEngineClass.asSubclass(java.lang.Short.class); + throw new AssertionError("Class.asSubclass(java.lang.Short.class) does not throw any exception"); + } + catch (Exception e) { + // expected exception + } + + try { + this.scriptEngineClass.asSubclass(java.lang.String.class); + throw new AssertionError("Class.asSubclass(java.lang.String.class) does not throw any exception"); + } + catch (Exception e) { + // expected exception + } + + try { + this.scriptEngineClass.asSubclass(java.lang.StringBuffer.class); + throw new AssertionError("Class.asSubclass(java.lang.StringBuffer.class) does not throw any exception"); + } + catch (Exception e) { + // expected exception + } + + try { + this.scriptEngineClass.asSubclass(java.lang.StringBuilder.class); + throw new AssertionError("Class.asSubclass(java.lang.StringBuilder.class) does not throw any exception"); + } + catch (Exception e) { + // expected exception + } + + try { + this.scriptEngineClass.asSubclass(java.awt.Color.class); + throw new AssertionError("Class.asSubclass(java.awt.Color.class) does not throw any exception"); + } + catch (Exception e) { + // expected exception + } + + try { + this.scriptEngineClass.asSubclass(java.awt.Font.class); + throw new AssertionError("Class.asSubclass(java.awt.Font.class) does not throw any exception"); + } + catch (Exception e) { + // expected exception + } + + try { + this.scriptEngineClass.asSubclass(java.awt.Image.class); + throw new AssertionError("Class.asSubclass(java.awt.Image.class) does not throw any exception"); + } + catch (Exception e) { + // expected exception + } + + try { + this.scriptEngineClass.asSubclass(javax.swing.JPanel.class); + throw new AssertionError("Class.asSubclass(javax.swing.JPanel.class) does not throw any exception"); + } + catch (Exception e) { + // expected exception + } + + try { + this.scriptEngineClass.asSubclass(javax.swing.JColorChooser.class); + throw new AssertionError("Class.asSubclass(javax.swing.JColorChooser.class) does not throw any exception"); + } + catch (Exception e) { + // expected exception + } + + try { + this.scriptEngineClass.asSubclass(javax.swing.JScrollBar.class); + throw new AssertionError("Class.asSubclass(javax.swing.JScrollBar.class) does not throw any exception"); + } + catch (Exception e) { + // expected exception + } + + try { + this.scriptEngineClass.asSubclass(javax.swing.JSlider.class); + throw new AssertionError("Class.asSubclass(javax.swing.JSlider.class) does not throw any exception"); + } + catch (Exception e) { + // expected exception + } + + } + + /** * Test for method javax.script.ScriptEngine.getClass().newInstance() */ protected void testNewInstance() {