/hg/rhino-tests: Added two new tests getGenericSuperclass() and ...

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Tue Jul 30 02:08:39 PDT 2013


changeset 8ebc2504f836 in /hg/rhino-tests
details: http://icedtea.classpath.org/hg/rhino-tests?cmd=changeset;node=8ebc2504f836
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Tue Jul 30 11:12:14 2013 +0200

	Added two new tests getGenericSuperclass() and getGenericInterfaces()
	into ScriptEngineFactoryClassTest.


diffstat:

 ChangeLog                                            |   6 ++
 src/org/RhinoTests/ScriptEngineFactoryClassTest.java |  54 ++++++++++++++++++++
 2 files changed, 60 insertions(+), 0 deletions(-)

diffs (77 lines):

diff -r 7c346e26d3d8 -r 8ebc2504f836 ChangeLog
--- a/ChangeLog	Mon Jul 29 12:13:59 2013 +0200
+++ b/ChangeLog	Tue Jul 30 11:12:14 2013 +0200
@@ -1,3 +1,9 @@
+2013-07-30  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/RhinoTests/ScriptEngineFactoryClassTest.java:
+	Added two new tests getGenericSuperclass() and getGenericInterfaces()
+	into ScriptEngineFactoryClassTest.
+
 2013-07-29  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/org/RhinoTests/ScriptEngineFactoryClassTest.java:
diff -r 7c346e26d3d8 -r 8ebc2504f836 src/org/RhinoTests/ScriptEngineFactoryClassTest.java
--- a/src/org/RhinoTests/ScriptEngineFactoryClassTest.java	Mon Jul 29 12:13:59 2013 +0200
+++ b/src/org/RhinoTests/ScriptEngineFactoryClassTest.java	Tue Jul 30 11:12:14 2013 +0200
@@ -1079,6 +1079,60 @@
     }
 
     /**
+     * Test for method javax.script.ScriptEngineFactory.getClass().getGenericSuperclass()
+     */
+    protected void testGetGenericSuperclass() {
+        Type genericSuperclass = this.scriptEngineFactoryClass.getGenericSuperclass();
+        assertNull(genericSuperclass, "getGenericSuperclass() does not return null");
+    }
+
+    /**
+     * Test for method javax.script.ScriptEngineFactory.getClass().getGenericInterfaces()
+     */
+    protected void testGetGenericInterfaces() {
+        // array of interface names that should exists
+        final String[] genericInterfaceNames_jdk6 = {
+        };
+
+        final String[] genericInterfaceNames_jdk7 = {
+        };
+
+        final String[] genericInterfaceNames_jdk8 = {
+        };
+
+        // get the right array of field signatures
+        String[] genericInterfaceNames = null;
+        switch (getJavaVersion()) {
+            case 6:
+                genericInterfaceNames = genericInterfaceNames_jdk6;
+                break;
+            case 7:
+                genericInterfaceNames = genericInterfaceNames_jdk7;
+                break;
+            case 8:
+                genericInterfaceNames = genericInterfaceNames_jdk8;
+                break;
+        }
+
+        // get all generic interfaces
+        Type[] genericInterfaces = this.scriptEngineFactoryClass.getGenericInterfaces();
+        assertNotNull(genericInterfaces, "getGenericInterfaces() returns null");
+        assertEquals(0, genericInterfaces.length, "array of wrong size returned by getGenericInterfaces " + genericInterfaces.length);
+
+        // and transform the array into a list of field names
+        List<String> interfacesAsString = new ArrayList<String>();
+        for (Type genericInterface : genericInterfaces) {
+            interfacesAsString.add(genericInterface.toString());
+        }
+
+        // check if all required interfaces really exists
+        for (String interfaceThatShouldExists : genericInterfaceNames) {
+            assertTrue(interfacesAsString.contains(interfaceThatShouldExists),
+                    "interface " + interfaceThatShouldExists + " not found");
+        }
+    }
+
+    /**
      * Test for method javax.script.ScriptEngineFactory.getClass().getEnumConstants()
      */
     protected void testGetEnumConstants() {



More information about the distro-pkg-dev mailing list