/hg/rhino-tests: Updated four tests in ScriptExceptionClassTest ...
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Wed Jun 26 01:55:39 PDT 2013
changeset 75e3e48ef286 in /hg/rhino-tests
details: http://icedtea.classpath.org/hg/rhino-tests?cmd=changeset;node=75e3e48ef286
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Wed Jun 26 10:59:13 2013 +0200
Updated four tests in ScriptExceptionClassTest for (Open)JDK8 API:
getMethod, getMethods, getDeclaredMethod and getDeclaredMethods.
diffstat:
ChangeLog | 6 +
src/org/RhinoTests/ScriptExceptionClassTest.java | 158 +++++++++++++++++++++-
2 files changed, 155 insertions(+), 9 deletions(-)
diffs (265 lines):
diff -r 91109f10e626 -r 75e3e48ef286 ChangeLog
--- a/ChangeLog Fri Jun 21 12:17:48 2013 +0200
+++ b/ChangeLog Wed Jun 26 10:59:13 2013 +0200
@@ -1,3 +1,9 @@
+2013-06-26 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * src/org/RhinoTests/ScriptExceptionClassTest.java:
+ Updated four tests in ScriptExceptionClassTest for (Open)JDK8 API:
+ getMethod, getMethods, getDeclaredMethod and getDeclaredMethods.
+
2013-06-21 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/RhinoTests/SimpleBindingsClassTest.java:
diff -r 91109f10e626 -r 75e3e48ef286 src/org/RhinoTests/ScriptExceptionClassTest.java
--- a/src/org/RhinoTests/ScriptExceptionClassTest.java Fri Jun 21 12:17:48 2013 +0200
+++ b/src/org/RhinoTests/ScriptExceptionClassTest.java Wed Jun 26 10:59:13 2013 +0200
@@ -699,7 +699,6 @@
"public java.lang.String java.lang.Throwable.toString()",
"public java.lang.String javax.script.ScriptException.getFileName()",
"public java.lang.String javax.script.ScriptException.getMessage()",
- "public java.lang.Throwable java.lang.Throwable.getCause()",
"public native int java.lang.Object.hashCode()",
"public synchronized java.lang.Throwable java.lang.Throwable.initCause(java.lang.Throwable)",
"public synchronized native java.lang.Throwable java.lang.Throwable.fillInStackTrace()",
@@ -715,6 +714,30 @@
"public final native void java.lang.Object.notify()",
"public final native void java.lang.Object.notifyAll()",
"public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException",
+ "public final void java.lang.Object.wait() throws java.lang.InterruptedException",
+ "public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException",
+ "public int javax.script.ScriptException.getColumnNumber()",
+ "public int javax.script.ScriptException.getLineNumber()",
+ "public java.lang.StackTraceElement[] java.lang.Throwable.getStackTrace()",
+ "public java.lang.String java.lang.Throwable.getLocalizedMessage()",
+ "public java.lang.String java.lang.Throwable.toString()",
+ "public java.lang.String javax.script.ScriptException.getFileName()",
+ "public java.lang.String javax.script.ScriptException.getMessage()",
+ "public native int java.lang.Object.hashCode()",
+ "public synchronized java.lang.Throwable java.lang.Throwable.initCause(java.lang.Throwable)",
+ "public synchronized java.lang.Throwable java.lang.Throwable.fillInStackTrace()",
+ "public void java.lang.Throwable.printStackTrace()",
+ "public void java.lang.Throwable.printStackTrace(java.io.PrintStream)",
+ "public void java.lang.Throwable.printStackTrace(java.io.PrintWriter)",
+ "public void java.lang.Throwable.setStackTrace(java.lang.StackTraceElement[])",
+ };
+
+ final String[] methodsThatShouldExist_jdk8 = {
+ "public boolean java.lang.Object.equals(java.lang.Object)",
+ "public final native java.lang.Class java.lang.Object.getClass()",
+ "public final native void java.lang.Object.notify()",
+ "public final native void java.lang.Object.notifyAll()",
+ "public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException",
"public final synchronized java.lang.Throwable[] java.lang.Throwable.getSuppressed()",
"public final synchronized void java.lang.Throwable.addSuppressed(java.lang.Throwable)",
"public final void java.lang.Object.wait() throws java.lang.InterruptedException",
@@ -743,7 +766,20 @@
for (Method method : methods) {
methodsAsString.add(method.toString());
}
- String[] methodsThatShouldExist = getJavaVersion() < 7 ? methodsThatShouldExist_jdk6 : methodsThatShouldExist_jdk7;
+
+ String[] methodsThatShouldExist = null;
+ switch (getJavaVersion()) {
+ case 6:
+ methodsThatShouldExist = methodsThatShouldExist_jdk6;
+ break;
+ case 7:
+ methodsThatShouldExist = methodsThatShouldExist_jdk7;
+ break;
+ case 8:
+ methodsThatShouldExist = methodsThatShouldExist_jdk8;
+ break;
+ }
+
// check if all required methods really exists
for (String methodThatShouldExists : methodsThatShouldExist) {
assertTrue(methodsAsString.contains(methodThatShouldExists),
@@ -770,6 +806,13 @@
"public java.lang.String javax.script.ScriptException.getMessage()",
};
+ final String[] declaredMethodsThatShouldExist_jdk8 = {
+ "public int javax.script.ScriptException.getColumnNumber()",
+ "public int javax.script.ScriptException.getLineNumber()",
+ "public java.lang.String javax.script.ScriptException.getFileName()",
+ "public java.lang.String javax.script.ScriptException.getMessage()",
+ };
+
// get all declared methods
Method[] declaredMethods = this.scriptExceptionClass.getDeclaredMethods();
// and transform the array into a list of method names
@@ -777,7 +820,20 @@
for (Method method : declaredMethods) {
methodsAsString.add(method.toString());
}
- String[] declaredMethodsThatShouldExist = getJavaVersion() < 7 ? declaredMethodsThatShouldExist_jdk6 : declaredMethodsThatShouldExist_jdk7;
+
+ String[] declaredMethodsThatShouldExist = null;
+ switch (getJavaVersion()) {
+ case 6:
+ declaredMethodsThatShouldExist = declaredMethodsThatShouldExist_jdk6;
+ break;
+ case 7:
+ declaredMethodsThatShouldExist = declaredMethodsThatShouldExist_jdk7;
+ break;
+ case 8:
+ declaredMethodsThatShouldExist = declaredMethodsThatShouldExist_jdk8;
+ break;
+ }
+
// check if all required methods really exists
for (String methodThatShouldExists : declaredMethodsThatShouldExist) {
assertTrue(methodsAsString.contains(methodThatShouldExists),
@@ -799,7 +855,6 @@
methodsThatShouldExist_jdk6.put("printStackTrace", new Class[] {java.io.PrintStream.class});
methodsThatShouldExist_jdk6.put("printStackTrace", new Class[] {java.io.PrintWriter.class});
methodsThatShouldExist_jdk6.put("fillInStackTrace", new Class[] {});
- methodsThatShouldExist_jdk6.put("getCause", new Class[] {});
methodsThatShouldExist_jdk6.put("initCause", new Class[] {java.lang.Throwable.class});
methodsThatShouldExist_jdk6.put("toString", new Class[] {});
methodsThatShouldExist_jdk6.put("getLocalizedMessage", new Class[] {});
@@ -823,7 +878,6 @@
methodsThatShouldExist_jdk7.put("printStackTrace", new Class[] {java.io.PrintWriter.class});
methodsThatShouldExist_jdk7.put("printStackTrace", new Class[] {java.io.PrintStream.class});
methodsThatShouldExist_jdk7.put("fillInStackTrace", new Class[] {});
- methodsThatShouldExist_jdk7.put("getCause", new Class[] {});
methodsThatShouldExist_jdk7.put("initCause", new Class[] {java.lang.Throwable.class});
methodsThatShouldExist_jdk7.put("toString", new Class[] {});
methodsThatShouldExist_jdk7.put("getLocalizedMessage", new Class[] {});
@@ -840,7 +894,44 @@
methodsThatShouldExist_jdk7.put("notify", new Class[] {});
methodsThatShouldExist_jdk7.put("notifyAll", new Class[] {});
- Map<String, Class[]> methodsThatShouldExist = getJavaVersion() < 7 ? methodsThatShouldExist_jdk6 : methodsThatShouldExist_jdk7;
+ Map<String, Class[]> methodsThatShouldExist_jdk8 = new TreeMap<String, Class[]>();
+ methodsThatShouldExist_jdk8.put("getColumnNumber", new Class[] {});
+ methodsThatShouldExist_jdk8.put("getMessage", new Class[] {});
+ methodsThatShouldExist_jdk8.put("getFileName", new Class[] {});
+ methodsThatShouldExist_jdk8.put("getLineNumber", new Class[] {});
+ methodsThatShouldExist_jdk8.put("printStackTrace", new Class[] {});
+ methodsThatShouldExist_jdk8.put("printStackTrace", new Class[] {java.io.PrintWriter.class});
+ methodsThatShouldExist_jdk8.put("printStackTrace", new Class[] {java.io.PrintStream.class});
+ methodsThatShouldExist_jdk8.put("fillInStackTrace", new Class[] {});
+ methodsThatShouldExist_jdk8.put("getCause", new Class[] {});
+ methodsThatShouldExist_jdk8.put("initCause", new Class[] {java.lang.Throwable.class});
+ methodsThatShouldExist_jdk8.put("toString", new Class[] {});
+ methodsThatShouldExist_jdk8.put("getLocalizedMessage", new Class[] {});
+ methodsThatShouldExist_jdk8.put("getStackTrace", new Class[] {});
+ methodsThatShouldExist_jdk8.put("setStackTrace", new Class[] {Class.forName("[Ljava.lang.StackTraceElement;")});
+ methodsThatShouldExist_jdk8.put("addSuppressed", new Class[] {java.lang.Throwable.class});
+ methodsThatShouldExist_jdk8.put("getSuppressed", new Class[] {});
+ methodsThatShouldExist_jdk8.put("wait", new Class[] {long.class, int.class});
+ methodsThatShouldExist_jdk8.put("wait", new Class[] {long.class});
+ methodsThatShouldExist_jdk8.put("wait", new Class[] {});
+ methodsThatShouldExist_jdk8.put("equals", new Class[] {java.lang.Object.class});
+ methodsThatShouldExist_jdk8.put("hashCode", new Class[] {});
+ methodsThatShouldExist_jdk8.put("getClass", new Class[] {});
+ methodsThatShouldExist_jdk8.put("notify", new Class[] {});
+ methodsThatShouldExist_jdk8.put("notifyAll", new Class[] {});
+
+ Map<String, Class[]> methodsThatShouldExist = null;
+ switch (getJavaVersion()) {
+ case 6:
+ methodsThatShouldExist = methodsThatShouldExist_jdk6;
+ break;
+ case 7:
+ methodsThatShouldExist = methodsThatShouldExist_jdk7;
+ break;
+ case 8:
+ methodsThatShouldExist = methodsThatShouldExist_jdk8;
+ break;
+ }
// check if all required methods really exist
for (Map.Entry<String, Class[]> methodThatShouldExists : methodsThatShouldExist.entrySet()) {
@@ -878,7 +969,24 @@
methodsThatShouldExist_jdk7.put("getLineNumber", new Class[] {});
methodsThatShouldExist_jdk7.put("getColumnNumber", new Class[] {});
- Map<String, Class[]> methodsThatShouldExist = getJavaVersion() < 7 ? methodsThatShouldExist_jdk6 : methodsThatShouldExist_jdk7;
+ Map<String, Class[]> methodsThatShouldExist_jdk8 = new TreeMap<String, Class[]>();
+ methodsThatShouldExist_jdk8.put("getColumnNumber", new Class[] {});
+ methodsThatShouldExist_jdk8.put("getMessage", new Class[] {});
+ methodsThatShouldExist_jdk8.put("getFileName", new Class[] {});
+ methodsThatShouldExist_jdk8.put("getLineNumber", new Class[] {});
+
+ Map<String, Class[]> methodsThatShouldExist = null;
+ switch (getJavaVersion()) {
+ case 6:
+ methodsThatShouldExist = methodsThatShouldExist_jdk6;
+ break;
+ case 7:
+ methodsThatShouldExist = methodsThatShouldExist_jdk7;
+ break;
+ case 8:
+ methodsThatShouldExist = methodsThatShouldExist_jdk8;
+ break;
+ }
// check if all required methods really exist
for (Map.Entry<String, Class[]> methodThatShouldExists : methodsThatShouldExist.entrySet()) {
@@ -910,6 +1018,9 @@
final String[] annotationsThatShouldExists_jdk7 = {
};
+ final String[] annotationsThatShouldExists_jdk8 = {
+ };
+
// get all annotations
Annotation[] annotations = this.scriptExceptionClass.getAnnotations();
// and transform the array into a list of annotation names
@@ -917,7 +1028,20 @@
for (Annotation annotation : annotations) {
annotationsAsString.add(annotation.toString());
}
- String[] annotationsThatShouldExists = getJavaVersion() < 7 ? annotationsThatShouldExists_jdk6 : annotationsThatShouldExists_jdk7;
+
+ String[] annotationsThatShouldExists = null;
+ switch (getJavaVersion()) {
+ case 6:
+ annotationsThatShouldExists = annotationsThatShouldExists_jdk6;
+ break;
+ case 7:
+ annotationsThatShouldExists = annotationsThatShouldExists_jdk7;
+ break;
+ case 8:
+ annotationsThatShouldExists = annotationsThatShouldExists_jdk8;
+ break;
+ }
+
// check if all required annotations really exists
for (String annotationThatShouldExists : annotationsThatShouldExists) {
assertTrue(annotationsAsString.contains(annotationThatShouldExists),
@@ -936,6 +1060,9 @@
final String[] annotationsThatShouldExists_jdk7 = {
};
+ final String[] annotationsThatShouldExists_jdk8 = {
+ };
+
// get all annotations
Annotation[] annotations = this.scriptExceptionClass.getDeclaredAnnotations();
// and transform the array into a list of annotation names
@@ -943,7 +1070,20 @@
for (Annotation annotation : annotations) {
annotationsAsString.add(annotation.toString());
}
- String[] annotationsThatShouldExists = getJavaVersion() < 7 ? annotationsThatShouldExists_jdk6 : annotationsThatShouldExists_jdk7;
+
+ String[] annotationsThatShouldExists = null;
+ switch (getJavaVersion()) {
+ case 6:
+ annotationsThatShouldExists = annotationsThatShouldExists_jdk6;
+ break;
+ case 7:
+ annotationsThatShouldExists = annotationsThatShouldExists_jdk7;
+ break;
+ case 8:
+ annotationsThatShouldExists = annotationsThatShouldExists_jdk8;
+ break;
+ }
+
// check if all required annotations really exists
for (String annotationThatShouldExists : annotationsThatShouldExists) {
assertTrue(annotationsAsString.contains(annotationThatShouldExists),
More information about the distro-pkg-dev
mailing list