/hg/rhino-tests: Updated four tests in SimpleBindingsClassTest f...

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Wed Jun 19 07:47:19 PDT 2013


changeset 5f4e9220c8a0 in /hg/rhino-tests
details: http://icedtea.classpath.org/hg/rhino-tests?cmd=changeset;node=5f4e9220c8a0
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Wed Jun 19 16:50:46 2013 +0200

	Updated four tests in SimpleBindingsClassTest for (Open)JDK8 API:
	getMethod, getMethods, getDeclaredMethod and getDeclaredMethods.


diffstat:

 ChangeLog                                       |    6 +
 src/org/RhinoTests/SimpleBindingsClassTest.java |  138 +++++++++++++++++++++++-
 2 files changed, 140 insertions(+), 4 deletions(-)

diffs (196 lines):

diff -r 620b718077c0 -r 5f4e9220c8a0 ChangeLog
--- a/ChangeLog	Tue Jun 18 14:24:02 2013 +0200
+++ b/ChangeLog	Wed Jun 19 16:50:46 2013 +0200
@@ -1,3 +1,9 @@
+2013-06-19  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/RhinoTests/SimpleBindingsClassTest.java:
+	Updated four tests in SimpleBindingsClassTest for (Open)JDK8 API:
+	getMethod, getMethods, getDeclaredMethod and getDeclaredMethods.
+
 2013-06-18  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/org/RhinoTests/ScriptExceptionClassTest.java:
diff -r 620b718077c0 -r 5f4e9220c8a0 src/org/RhinoTests/SimpleBindingsClassTest.java
--- a/src/org/RhinoTests/SimpleBindingsClassTest.java	Tue Jun 18 14:24:02 2013 +0200
+++ b/src/org/RhinoTests/SimpleBindingsClassTest.java	Wed Jun 19 16:50:46 2013 +0200
@@ -696,6 +696,31 @@
             "public void javax.script.SimpleBindings.putAll(java.util.Map)",
         };
 
+        final String[] methodsThatShouldExist_jdk8 = {
+            "public boolean java.lang.Object.equals(java.lang.Object)",
+            "public boolean javax.script.SimpleBindings.containsKey(java.lang.Object)",
+            "public boolean javax.script.SimpleBindings.containsValue(java.lang.Object)",
+            "public boolean javax.script.SimpleBindings.isEmpty()",
+            "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 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.SimpleBindings.size()",
+            "public java.lang.Object javax.script.SimpleBindings.get(java.lang.Object)",
+            "public java.lang.Object javax.script.SimpleBindings.put(java.lang.Object,java.lang.Object)",
+            "public java.lang.Object javax.script.SimpleBindings.put(java.lang.String,java.lang.Object)",
+            "public java.lang.Object javax.script.SimpleBindings.remove(java.lang.Object)",
+            "public java.lang.String java.lang.Object.toString()",
+            "public java.util.Collection javax.script.SimpleBindings.values()",
+            "public java.util.Set javax.script.SimpleBindings.entrySet()",
+            "public java.util.Set javax.script.SimpleBindings.keySet()",
+            "public native int java.lang.Object.hashCode()",
+            "public void javax.script.SimpleBindings.clear()",
+            "public void javax.script.SimpleBindings.putAll(java.util.Map)",
+        };
+
         // get all inherited methods
         Method[] methods = this.simpleBindingsClass.getMethods();
         // and transform the array into a list of method names
@@ -703,7 +728,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),
@@ -750,6 +788,23 @@
             "public void javax.script.SimpleBindings.putAll(java.util.Map)",
         };
 
+        final String[] declaredMethodsThatShouldExist_jdk8 = {
+            "private void javax.script.SimpleBindings.checkKey(java.lang.Object)",
+            "public boolean javax.script.SimpleBindings.containsKey(java.lang.Object)",
+            "public boolean javax.script.SimpleBindings.containsValue(java.lang.Object)",
+            "public boolean javax.script.SimpleBindings.isEmpty()",
+            "public int javax.script.SimpleBindings.size()",
+            "public java.lang.Object javax.script.SimpleBindings.get(java.lang.Object)",
+            "public java.lang.Object javax.script.SimpleBindings.put(java.lang.Object,java.lang.Object)",
+            "public java.lang.Object javax.script.SimpleBindings.put(java.lang.String,java.lang.Object)",
+            "public java.lang.Object javax.script.SimpleBindings.remove(java.lang.Object)",
+            "public java.util.Collection javax.script.SimpleBindings.values()",
+            "public java.util.Set javax.script.SimpleBindings.entrySet()",
+            "public java.util.Set javax.script.SimpleBindings.keySet()",
+            "public void javax.script.SimpleBindings.clear()",
+            "public void javax.script.SimpleBindings.putAll(java.util.Map)",
+        };
+
         // get all declared methods
         Method[] declaredMethods = this.simpleBindingsClass.getDeclaredMethods();
         // and transform the array into a list of method names
@@ -757,7 +812,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),
@@ -818,7 +886,42 @@
         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("remove", new Class[] {java.lang.Object.class});
+        methodsThatShouldExist_jdk8.put("get", new Class[] {java.lang.Object.class});
+        methodsThatShouldExist_jdk8.put("put", new Class[] {java.lang.String.class, java.lang.Object.class});
+        methodsThatShouldExist_jdk8.put("put", new Class[] {java.lang.Object.class, java.lang.Object.class});
+        methodsThatShouldExist_jdk8.put("values", new Class[] {});
+        methodsThatShouldExist_jdk8.put("clear", new Class[] {});
+        methodsThatShouldExist_jdk8.put("isEmpty", new Class[] {});
+        methodsThatShouldExist_jdk8.put("size", new Class[] {});
+        methodsThatShouldExist_jdk8.put("entrySet", new Class[] {});
+        methodsThatShouldExist_jdk8.put("putAll", new Class[] {java.util.Map.class});
+        methodsThatShouldExist_jdk8.put("keySet", new Class[] {});
+        methodsThatShouldExist_jdk8.put("containsValue", new Class[] {java.lang.Object.class});
+        methodsThatShouldExist_jdk8.put("containsKey", new Class[] {java.lang.Object.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("toString", new 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()) {
@@ -876,7 +979,34 @@
         methodsThatShouldExist_jdk7.put("containsKey", new Class[] {java.lang.Object.class});
         methodsThatShouldExist_jdk7.put("containsValue", new Class[] {java.lang.Object.class});
 
-        Map<String, Class[]> methodsThatShouldExist = getJavaVersion() < 7 ? methodsThatShouldExist_jdk6 : methodsThatShouldExist_jdk7;
+        Map<String, Class[]> methodsThatShouldExist_jdk8 = new TreeMap<String, Class[]>();
+        methodsThatShouldExist_jdk8.put("remove", new Class[] {java.lang.Object.class});
+        methodsThatShouldExist_jdk8.put("get", new Class[] {java.lang.Object.class});
+        methodsThatShouldExist_jdk8.put("put", new Class[] {java.lang.String.class, java.lang.Object.class});
+        methodsThatShouldExist_jdk8.put("put", new Class[] {java.lang.Object.class, java.lang.Object.class});
+        methodsThatShouldExist_jdk8.put("values", new Class[] {});
+        methodsThatShouldExist_jdk8.put("clear", new Class[] {});
+        methodsThatShouldExist_jdk8.put("isEmpty", new Class[] {});
+        methodsThatShouldExist_jdk8.put("size", new Class[] {});
+        methodsThatShouldExist_jdk8.put("entrySet", new Class[] {});
+        methodsThatShouldExist_jdk8.put("putAll", new Class[] {java.util.Map.class});
+        methodsThatShouldExist_jdk8.put("checkKey", new Class[] {java.lang.Object.class});
+        methodsThatShouldExist_jdk8.put("keySet", new Class[] {});
+        methodsThatShouldExist_jdk8.put("containsValue", new Class[] {java.lang.Object.class});
+        methodsThatShouldExist_jdk8.put("containsKey", new Class[] {java.lang.Object.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()) {



More information about the distro-pkg-dev mailing list