/hg/rhino-tests: Nine new tests added into the CompiledScriptCla...
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Wed Mar 27 01:40:31 PDT 2013
changeset 17efcaa18b1d in /hg/rhino-tests
details: http://icedtea.classpath.org/hg/rhino-tests?cmd=changeset;node=17efcaa18b1d
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Wed Mar 27 09:43:44 2013 +0100
Nine new tests added into the CompiledScriptClassTest test suite.
diffstat:
ChangeLog | 5 +
src/org/RhinoTests/CompiledScriptClassTest.java | 107 ++++++++++++++++++++++++
2 files changed, 112 insertions(+), 0 deletions(-)
diffs (129 lines):
diff -r 3f01a2f5aaf0 -r 17efcaa18b1d ChangeLog
--- a/ChangeLog Tue Mar 26 09:21:35 2013 +0100
+++ b/ChangeLog Wed Mar 27 09:43:44 2013 +0100
@@ -1,3 +1,8 @@
+2013-03-27 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * src/org/RhinoTests/CompiledScriptClassTest.java:
+ Nine new tests added into the CompiledScriptClassTest test suite.
+
2013-03-26 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/RhinoTests/ScriptEngineClassTest.java:
diff -r 3f01a2f5aaf0 -r 17efcaa18b1d src/org/RhinoTests/CompiledScriptClassTest.java
--- a/src/org/RhinoTests/CompiledScriptClassTest.java Tue Mar 26 09:21:35 2013 +0100
+++ b/src/org/RhinoTests/CompiledScriptClassTest.java Wed Mar 27 09:43:44 2013 +0100
@@ -776,6 +776,113 @@
}
/**
+ * Test for method javax.script.CompiledScript.getClass().getDeclaredAnnotations()
+ */
+ protected void testGetDeclaredAnnotations() {
+ // following annotations should be provided
+ final String[] annotationsThatShouldExists_jdk6 = {
+ };
+
+ final String[] annotationsThatShouldExists_jdk7 = {
+ };
+
+ // get all annotations
+ Annotation[] annotations = this.compiledScriptClass.getDeclaredAnnotations();
+ // and transform the array into a list of annotation names
+ List<String> annotationsAsString = new ArrayList<String>();
+ for (Annotation annotation : annotations) {
+ annotationsAsString.add(annotation.toString());
+ }
+ String[] annotationsThatShouldExists = getJavaVersion() < 7 ? annotationsThatShouldExists_jdk6 : annotationsThatShouldExists_jdk7;
+ // check if all required annotations really exists
+ for (String annotationThatShouldExists : annotationsThatShouldExists) {
+ assertTrue(annotationsAsString.contains(annotationThatShouldExists),
+ "annotation " + annotationThatShouldExists + " not found");
+ }
+ }
+
+ /**
+ * Test for method javax.script.CompiledScript.getClass().getAnnotation()
+ */
+ protected void testGetAnnotation() {
+ Annotation annotation;
+ annotation = this.compiledScriptClass.getAnnotation(java.lang.annotation.Annotation.class);
+ assertNull(annotation, "annotation java.lang.annotation.Annotation should not be returned");
+ annotation = this.compiledScriptClass.getAnnotation(java.lang.annotation.Documented.class);
+ assertNull(annotation, "annotation java.lang.annotation.Documented should not be returned");
+ annotation = this.compiledScriptClass.getAnnotation(java.lang.annotation.Inherited.class);
+ assertNull(annotation, "annotation java.lang.annotation.Inherited should not be returned");
+ annotation = this.compiledScriptClass.getAnnotation(java.lang.annotation.Retention.class);
+ assertNull(annotation, "annotation java.lang.annotation.Retention should not be returned");
+ annotation = this.compiledScriptClass.getAnnotation(java.lang.annotation.Target.class);
+ assertNull(annotation, "annotation java.lang.annotation.Target should not be returned");
+ annotation = this.compiledScriptClass.getAnnotation(java.lang.Deprecated.class);
+ assertNull(annotation, "annotation java.lang.Deprecated should not be returned");
+ annotation = this.compiledScriptClass.getAnnotation(java.lang.Override.class);
+ assertNull(annotation, "annotation java.lang.Override should not be returned");
+ annotation = this.compiledScriptClass.getAnnotation(java.lang.SuppressWarnings.class);
+ assertNull(annotation, "annotation java.lang.SuppressWarnings should not be returned");
+ }
+
+ /**
+ * Test for method javax.script.CompiledScript.getClass().getComponentType()
+ */
+ protected void testGetComponentType() {
+ Class<?> cls = this.compiledScriptClass.getComponentType();
+ assertNull(cls, "getComponentType() should returns null");
+ }
+
+ /**
+ * Test for method javax.script.CompiledScript.getClass().getClasses()
+ */
+ protected void testGetClasses() {
+ Class<?>[] cls = this.compiledScriptClass.getClasses();
+ assertNotNull(cls, "getClasses() returns null");
+ assertEquals(cls.length, 0, "getClasses() returns wrong value!");
+ }
+
+ /**
+ * Test for method javax.script.CompiledScript.getClass().getDeclaredClasses()
+ */
+ protected void testGetDeclaredClasses() {
+ Class<?>[] cls = this.compiledScriptClass.getDeclaredClasses();
+ assertNotNull(cls, "getDeclaredClasses() returns null");
+ assertEquals(cls.length, 0, "getDeclaredClasses() returns wrong value!");
+ }
+
+ /**
+ * Test for method javax.script.CompiledScript.getClass().getDeclaringClass()
+ */
+ protected void testGetDeclaringClass() {
+ Class<?> cls = this.compiledScriptClass.getDeclaringClass();
+ assertNull(cls, "getDeclaringClass() does not return null");
+ }
+
+ /**
+ * Test for method javax.script.CompiledScript.getClass().getEnclosingClass()
+ */
+ protected void testGetEnclosingClass() {
+ Class<?> cls = this.compiledScriptClass.getEnclosingClass();
+ assertNull(cls, "getEnclosingClass() does not return null");
+ }
+
+ /**
+ * Test for method javax.script.CompiledScript.getClass().getEnclosingConstructor()
+ */
+ protected void testGetEnclosingConstructor() {
+ Constructor<?> cons = this.compiledScriptClass.getEnclosingConstructor();
+ assertNull(cons, "getEnclosingConstructor() does not return null");
+ }
+
+ /**
+ * Test for method javax.script.CompiledScript.getClass().getEnclosingMethod()
+ */
+ protected void testGetEnclosingMethod() {
+ Method m = this.compiledScriptClass.getEnclosingMethod();
+ assertNull(m, "getEnclosingMethod() does not return null");
+ }
+
+ /**
* Test for instanceof operator applied to a class javax.script.CompiledScript
*/
@SuppressWarnings("cast")
More information about the distro-pkg-dev
mailing list