/hg/rhino-tests: Three new tests added into the test suite Scrip...
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Wed Jan 30 00:19:03 PST 2013
changeset 667993be1ed8 in /hg/rhino-tests
details: http://icedtea.classpath.org/hg/rhino-tests?cmd=changeset;node=667993be1ed8
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Wed Jan 30 09:22:04 2013 +0100
Three new tests added into the test suite ScriptEngineClassTest.
diffstat:
ChangeLog | 5 +
src/org/RhinoTests/ScriptEngineClassTest.java | 72 ++++++++++++++++++++++++++-
2 files changed, 76 insertions(+), 1 deletions(-)
diffs (115 lines):
diff -r 5292981a360e -r 667993be1ed8 ChangeLog
--- a/ChangeLog Tue Jan 29 09:47:12 2013 +0100
+++ b/ChangeLog Wed Jan 30 09:22:04 2013 +0100
@@ -1,3 +1,8 @@
+2013-01-30 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * src/org/RhinoTests/ScriptEngineClassTest.java:
+ Three new tests added into the test suite ScriptEngineClassTest.
+
2013-01-29 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/RhinoTests/ScriptContextClassTest.java:
diff -r 5292981a360e -r 667993be1ed8 src/org/RhinoTests/ScriptEngineClassTest.java
--- a/src/org/RhinoTests/ScriptEngineClassTest.java Tue Jan 29 09:47:12 2013 +0100
+++ b/src/org/RhinoTests/ScriptEngineClassTest.java Wed Jan 30 09:22:04 2013 +0100
@@ -1,7 +1,7 @@
/*
Rhino test framework
- Copyright (C) 2011, 2012 Red Hat
+ Copyright (C) 2011, 2012, 2013 Red Hat
This file is part of IcedTea.
@@ -45,6 +45,7 @@
import java.util.List;
import java.util.Map;
import java.util.HashMap;
+import java.util.TreeMap;
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
@@ -261,6 +262,15 @@
}
/**
+ * Test for method javax.script.ScriptEngine.getClass().getCanonicalName()
+ */
+ protected void testGetCanonicalName() {
+ String canonicalName = this.scriptEngineClass.getCanonicalName();
+ assertEquals(canonicalName, "javax.script.ScriptEngine",
+ "Method javax.script.ScriptEngine.getClass().getCanonicalName() returns wrong value " + canonicalName);
+ }
+
+ /**
* Test for method javax.script.ScriptEngine.getClass().getSuperclass()
*/
protected void testGetSuperclass() {
@@ -314,6 +324,66 @@
}
/**
+ * Test for method javax.script.ScriptEngine.getClass().getConstructor()
+ */
+ protected void testGetConstructor() {
+ // following constructors should exist
+ Map<String, Class[]> constructorsThatShouldExist_jdk6 = new TreeMap<String, Class[]>();
+
+ Map<String, Class[]> constructorsThatShouldExist_jdk7 = new TreeMap<String, Class[]>();
+
+ Map<String, Class[]> constructorsThatShouldExist = getJavaVersion() < 7 ? constructorsThatShouldExist_jdk6 : constructorsThatShouldExist_jdk7;
+
+ // check if all required constructors really exist
+ for (Map.Entry<String, Class[]> constructorThatShouldExists : constructorsThatShouldExist.entrySet()) {
+ try {
+ Constructor constructor = this.scriptEngineClass.getConstructor(constructorThatShouldExists.getValue());
+ assertNotNull(constructor,
+ "constructor " + constructorThatShouldExists.getKey() + " not found");
+ String constructorName = constructor.getName();
+ assertNotNull(constructorName,
+ "constructor " + constructorThatShouldExists.getKey() + " does not have name assigned");
+ assertTrue(constructorName.equals(constructorThatShouldExists.getKey()),
+ "constructor " + constructorThatShouldExists.getKey() + " not found");
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ throw new AssertionError(e.getMessage());
+ }
+ }
+ }
+
+ /**
+ * Test for method javax.script.ScriptEngine.getClass().getDeclaredConstructor()
+ */
+ protected void testGetDeclaredConstructor() {
+ // following constructors should exist
+ Map<String, Class[]> constructorsThatShouldExist_jdk6 = new TreeMap<String, Class[]>();
+
+ Map<String, Class[]> constructorsThatShouldExist_jdk7 = new TreeMap<String, Class[]>();
+
+ Map<String, Class[]> constructorsThatShouldExist = getJavaVersion() < 7 ? constructorsThatShouldExist_jdk6 : constructorsThatShouldExist_jdk7;
+
+ // check if all required constructors really exist
+ for (Map.Entry<String, Class[]> constructorThatShouldExists : constructorsThatShouldExist.entrySet()) {
+ try {
+ Constructor constructor = this.scriptEngineClass.getDeclaredConstructor(constructorThatShouldExists.getValue());
+ assertNotNull(constructor,
+ "constructor " + constructorThatShouldExists.getKey() + " not found");
+ String constructorName = constructor.getName();
+ assertNotNull(constructorName,
+ "constructor " + constructorThatShouldExists.getKey() + " does not have name assigned");
+ assertTrue(constructorName.equals(constructorThatShouldExists.getKey()),
+ "constructor " + constructorThatShouldExists.getKey() + " not found");
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ throw new AssertionError(e.getMessage());
+ }
+ }
+ }
+
+ /**
* Test for method javax.script.ScriptEngine.getClass().getFields()
*/
protected void testGetFields() {
More information about the distro-pkg-dev
mailing list