view src/org/RhinoTests/ScriptExceptionClassTest.java @ 324:ab31415af980 draft

Added new test testGetResourceAsStreamPositiveTest into ScriptExceptionClassTest.
author Pavel Tisnovsky <ptisnovs@redhat.com>
date Thu, 27 Feb 2014 10:13:39 +0100
parents 90ec2e72a315
children 6c88fa309557
line wrap: on
line source

/*
  Rhino test framework

   Copyright (C) 2011, 2012, 2013, 2014  Red Hat

This file is part of IcedTea.

IcedTea is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.

IcedTea is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with IcedTea; see the file COPYING.  If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.

Linking this library statically or dynamically with other modules is
making a combined work based on this library.  Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.

As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module.  An independent module is a module which is not derived from
or based on this library.  If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so.  If you do not wish to do so, delete this
exception statement from your version.
*/

package org.RhinoTests;

import java.util.Arrays;
import java.util.ArrayList;
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;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;

import javax.script.ScriptException;



/**
 * Set of tests which check the API of ScriptException class using
 * Java reflection API.
 *
 * @author Pavel Tisnovsky
 */
public class ScriptExceptionClassTest extends BaseRhinoTest {

    /**
     * Object that represents the type of ScriptException.
     */
    Class<?> scriptExceptionClass = null;

    @Override
    protected void setUp(String[] args) {
        // setup attribute used by tests
        this.scriptExceptionClass = ScriptException.class;
    }

    @Override
    protected void tearDown() {
        // this block could be empty
        return;
    }

    /**
     * Test for method javax.script.ScriptException.getClass().isAssignableFrom()
     */
    protected void testIsAssignableFrom() {
        assertTrue(this.scriptExceptionClass.isAssignableFrom(ScriptException.class),
                "Method ScriptException.getClass().isAssignableFrom() returns wrong value");
    }

    /**
     * Test for method javax.script.ScriptException.getClass().isInstance()
     */
    protected void testIsInstance() {
        assertTrue(this.scriptExceptionClass.isInstance(new ScriptException("script exception")),
                "Method ScriptException.getClass().isInstance() returns wrong value");
    }

    /**
     * Test for method javax.script.ScriptException.getClass().isInterface()
     */
    protected void testIsInterface() {
        assertFalse(this.scriptExceptionClass.isInterface(),
                "Method ScriptException.getClass().isInterface() returns wrong value");
    }

    /**
     * Test for method javax.script.ScriptException.getClass().isLocalClass()
     */
    protected void testIsLocalClass() {
        assertFalse(this.scriptExceptionClass.isLocalClass(),
                "Method ScriptException.getClass().isLocalClass() returns wrong value");
    }

    /**
     * Test for method javax.script.ScriptException.getClass().isMemberClass()
     */
    protected void testIsMemberClass() {
        assertFalse(this.scriptExceptionClass.isMemberClass(),
                "Method ScriptException.getClass().isMemberClass() returns wrong value");
    }

    /**
     * Test for method javax.script.ScriptException.getClass().isPrimitive()
     */
    protected void testIsPrimitive() {
        assertFalse(this.scriptExceptionClass.isPrimitive(),
                "Method ScriptException.getClass().isPrimitive() returns wrong value");
    }

    /**
     * Test for method javax.script.ScriptException.getClass().isSynthetic()
     */
    protected void testIsSynthetic() {
        assertFalse(this.scriptExceptionClass.isSynthetic(),
                "Method ScriptException.getClass().isSynthetic() returns wrong value");
    }

    /**
     * Test for method javax.script.ScriptException.getClass().isAnnotation()
     */
    protected void testIsAnnotation() {
        assertFalse(this.scriptExceptionClass.isAnnotation(),
                "Method ScriptException.getClass().isAnnotation() returns wrong value");
    }

    /**
     * Test for method javax.script.ScriptException.getClass().isAnnotationPresent()
     */
    protected void testIsAnnotationPresent() {
        assertFalse(this.scriptExceptionClass.isAnnotationPresent(java.lang.annotation.Annotation.class),
                "Method ScriptException.getClass().isAnnotationPresent(java.lang.annotation.Annotation.class) returns wrong value");
        assertFalse(this.scriptExceptionClass.isAnnotationPresent(java.lang.annotation.Documented.class),
                "Method ScriptException.getClass().isAnnotationPresent(java.lang.annotation.Documented.class) returns wrong value");
        assertFalse(this.scriptExceptionClass.isAnnotationPresent(java.lang.annotation.Inherited.class),
                "Method ScriptException.getClass().isAnnotationPresent(java.lang.annotation.Inherited.class) returns wrong value");
        assertFalse(this.scriptExceptionClass.isAnnotationPresent(java.lang.annotation.Retention.class),
                "Method ScriptException.getClass().isAnnotationPresent(java.lang.annotation.Retention.class) returns wrong value");
        assertFalse(this.scriptExceptionClass.isAnnotationPresent(java.lang.annotation.Target.class),
                "Method ScriptException.getClass().isAnnotationPresent(java.lang.annotation.Target.class) returns wrong value");
        assertFalse(this.scriptExceptionClass.isAnnotationPresent(java.lang.Deprecated.class),
                "Method ScriptException.getClass().isAnnotationPresent(java.lang.Deprecated.class) returns wrong value");
        assertFalse(this.scriptExceptionClass.isAnnotationPresent(java.lang.Override.class),
                "Method ScriptException.getClass().isAnnotationPresent(java.lang.Override.class) returns wrong value");
        assertFalse(this.scriptExceptionClass.isAnnotationPresent(java.lang.SuppressWarnings.class),
                "Method ScriptException.getClass().isAnnotationPresent(java.lang.SuppressWarnings.class) returns wrong value");
    }

    /**
     * Test for method javax.script.ScriptException.getClass().isAnonymousClass()
     */
    protected void testIsAnonymousClass() {
        assertFalse(this.scriptExceptionClass.isAnonymousClass(),
                "Method ScriptException.getClass().isAnonymousClass() returns wrong value");
    }

    /**
     * Test for method javax.script.ScriptException.getClass().isArray()
     */
    protected void testIsArray() {
        assertFalse(this.scriptExceptionClass.isArray(),
                "Method ScriptException.getClass().isArray() returns wrong value");
    }

    /**
     * Test for method javax.script.ScriptException.getClass().isEnum()
     */
    protected void testIsEnum() {
        assertFalse(this.scriptExceptionClass.isEnum(),
                "Method ScriptException.getClass().isEnum() returns wrong value");
    }

    /**
     * Test for method javax.script.ScriptException.getClass().getInterfaces()
     */
    protected void testGetInterfaces() {
        List<Class<?>> interfaces = Arrays.asList(this.scriptExceptionClass.getInterfaces());
        assertTrue(interfaces.isEmpty(),
                "list of implemented interfaces should be empty");
    }

    /**
     * Test for method javax.script.ScriptException.getClass().getModifiers()
     */
    protected void testGetModifiers() {
        int modifiers = this.scriptExceptionClass.getModifiers();
        assertTrue(Modifier.isPublic(modifiers),
                "Method ScriptException.getClass().getModifiers() - isPublic modifier is set to a wrong value");
        assertFalse(Modifier.isPrivate(modifiers),
                "Method ScriptException.getClass().getModifiers() - isPrivate modifier is set to a wrong value");
        assertFalse(Modifier.isProtected(modifiers),
                "Method ScriptException.getClass().getModifiers() - isProtected modifier is set to a wrong value");
        assertFalse(Modifier.isAbstract(modifiers),
                "Method ScriptException.getClass().getModifiers() - isAbstract modifier is set to a wrong value");
        assertFalse(Modifier.isFinal(modifiers),
                "Method ScriptException.getClass().getModifiers() - isFinal modifier is set to a wrong value");
        assertFalse(Modifier.isInterface(modifiers),
                "Method ScriptException.getClass().getModifiers() - isInterface modifier is set to a wrong value");
        assertFalse(Modifier.isNative(modifiers),
                "Method ScriptException.getClass().getModifiers() - isNative modifier is set to a wrong value");
        assertFalse(Modifier.isStatic(modifiers),
                "Method ScriptException.getClass().getModifiers() - isStatic modifier is set to a wrong value");
        assertFalse(Modifier.isStrict(modifiers),
                "Method ScriptException.getClass().getModifiers() - isStrict modifier is set to a wrong value");
        assertFalse(Modifier.isSynchronized(modifiers),
                "Method ScriptException.getClass().getModifiers() - isSynchronized modifier is set to a wrong value");
        assertFalse(Modifier.isTransient(modifiers),
                "Method ScriptException.getClass().getModifiers() - isTransient modifier is set to a wrong value");
        assertFalse(Modifier.isVolatile(modifiers),
                "Method ScriptException.getClass().getModifiers() - isVolatile modifier is set to a wrong value");
    }

    /**
     * Test for method javax.script.ScriptException.getClass().getName()
     */
    protected void testGetName() {
        String name = this.scriptExceptionClass.getName();
        assertEquals(name, "javax.script.ScriptException",
                "Method ScriptException.getClass().getName() returns wrong value " + name);
    }

    /**
     * Test for method javax.script.ScriptException.getClass().getPackage()
     */
    protected void testGetPackage() {
        Package p = this.scriptExceptionClass.getPackage();
        String packageName = p.getName();
        assertEquals(packageName, "javax.script",
                "Method ScriptException.getClass().getPackage().getName() returns wrong value " + packageName);
    }

    /**
     * Test for method javax.script.ScriptException.getClass().getSimpleName()
     */
    protected void testGetSimpleName() {
        String simpleName = this.scriptExceptionClass.getSimpleName();
        assertEquals(simpleName, "ScriptException",
                "Method ScriptException.getClass().getSimpleName() returns wrong value " + simpleName);
    }

    /**
     * Test for method javax.script.ScriptException.getClass().getCanonicalName()
     */
    protected void testGetCanonicalName() {
        String canonicalName = this.scriptExceptionClass.getCanonicalName();
        assertEquals(canonicalName, "javax.script.ScriptException",
                "Method javax.script.ScriptException.getClass().getCanonicalName() returns wrong value " + canonicalName);
    }

    /**
     * Test for method javax.script.ScriptException.getClass().getSuperclass()
     */
    protected void testGetSuperclass() {
        Class<?> superClass = this.scriptExceptionClass.getSuperclass();
        String superClassName = superClass.getName();
        assertEquals(superClassName, "java.lang.Exception",
                "Method ScriptException.getClass().getSuperclass() returns wrong value " + superClassName);
    }

    /**
     * Test for method javax.script.ScriptException.getClass().getConstructors()
     */
    protected void testGetConstructors() {
        // map of constructors which should exists
        @SuppressWarnings("unused")
        Map<String, String> testedConstructors = null;
        Map<String, String> testedConstructors_jdk6 = new HashMap<String, String>();
        Map<String, String> testedConstructors_jdk7 = new HashMap<String, String>();
        Map<String, String> testedConstructors_jdk8 = new HashMap<String, String>();

        testedConstructors_jdk6.put("public javax.script.ScriptException(java.lang.String)", "javax.script.ScriptException");
        testedConstructors_jdk6.put("public javax.script.ScriptException(java.lang.Exception)", "javax.script.ScriptException");
        testedConstructors_jdk6.put("public javax.script.ScriptException(java.lang.String,java.lang.String,int)", "javax.script.ScriptException");
        testedConstructors_jdk6.put("public javax.script.ScriptException(java.lang.String,java.lang.String,int,int)", "javax.script.ScriptException");

        testedConstructors_jdk7.put("public javax.script.ScriptException(java.lang.String,java.lang.String,int,int)", "javax.script.ScriptException");
        testedConstructors_jdk7.put("public javax.script.ScriptException(java.lang.String,java.lang.String,int)", "javax.script.ScriptException");
        testedConstructors_jdk7.put("public javax.script.ScriptException(java.lang.Exception)", "javax.script.ScriptException");
        testedConstructors_jdk7.put("public javax.script.ScriptException(java.lang.String)", "javax.script.ScriptException");

        testedConstructors_jdk8.put("public javax.script.ScriptException(java.lang.String)", "javax.script.ScriptException");
        testedConstructors_jdk8.put("public javax.script.ScriptException(java.lang.String,java.lang.String,int,int)", "javax.script.ScriptException");
        testedConstructors_jdk8.put("public javax.script.ScriptException(java.lang.String,java.lang.String,int)", "javax.script.ScriptException");
        testedConstructors_jdk8.put("public javax.script.ScriptException(java.lang.Exception)", "javax.script.ScriptException");

        // get the right map containing constructor signatures
        switch (getJavaVersion()) {
            case 6:
                testedConstructors = testedConstructors_jdk6;
                break;
            case 7:
                testedConstructors = testedConstructors_jdk7;
                break;
            case 8:
                testedConstructors = testedConstructors_jdk8;
                break;
        }

        // get all constructors for this class
        Constructor<?>[] constructors = this.scriptExceptionClass.getConstructors();

        // basic check for a number of constructors
        assertEquals(constructors.length, 4, "only 4 constructors should be set");

        // check if all constructors exists
        for (Constructor<?> constructor : constructors) {
            String constructorName = constructor.getName();
            String constructorString = constructor.toString();
            assertTrue(testedConstructors.containsKey(constructorString), "wrong constructor.toString() " + constructorName);
            assertEquals(testedConstructors.get(constructorString), constructorName, "wrong constructor name " + constructorName);
        }
    }

    /**
     * Test for method javax.script.ScriptException.getClass().getDeclaredConstructors()
     */
    protected void testGetDeclaredConstructors() {
        // map of constructors which should exists
        @SuppressWarnings("unused")
        Map<String, String> testedConstructors = null;
        Map<String, String> testedConstructors_jdk6 = new HashMap<String, String>();
        Map<String, String> testedConstructors_jdk7 = new HashMap<String, String>();
        Map<String, String> testedConstructors_jdk8 = new HashMap<String, String>();

        testedConstructors_jdk6.put("public javax.script.ScriptException(java.lang.String)", "javax.script.ScriptException");
        testedConstructors_jdk6.put("public javax.script.ScriptException(java.lang.Exception)", "javax.script.ScriptException");
        testedConstructors_jdk6.put("public javax.script.ScriptException(java.lang.String,java.lang.String,int)", "javax.script.ScriptException");
        testedConstructors_jdk6.put("public javax.script.ScriptException(java.lang.String,java.lang.String,int,int)", "javax.script.ScriptException");

        testedConstructors_jdk7.put("public javax.script.ScriptException(java.lang.String,java.lang.String,int,int)", "javax.script.ScriptException");
        testedConstructors_jdk7.put("public javax.script.ScriptException(java.lang.String,java.lang.String,int)", "javax.script.ScriptException");
        testedConstructors_jdk7.put("public javax.script.ScriptException(java.lang.Exception)", "javax.script.ScriptException");
        testedConstructors_jdk7.put("public javax.script.ScriptException(java.lang.String)", "javax.script.ScriptException");

        testedConstructors_jdk8.put("public javax.script.ScriptException(java.lang.String)", "javax.script.ScriptException");
        testedConstructors_jdk8.put("public javax.script.ScriptException(java.lang.String,java.lang.String,int,int)", "javax.script.ScriptException");
        testedConstructors_jdk8.put("public javax.script.ScriptException(java.lang.String,java.lang.String,int)", "javax.script.ScriptException");
        testedConstructors_jdk8.put("public javax.script.ScriptException(java.lang.Exception)", "javax.script.ScriptException");

        // get the right map containing constructor signatures
        switch (getJavaVersion()) {
            case 6:
                testedConstructors = testedConstructors_jdk6;
                break;
            case 7:
                testedConstructors = testedConstructors_jdk7;
                break;
            case 8:
                testedConstructors = testedConstructors_jdk8;
                break;
        }

        // get all declared constructors for this class
        Constructor<?>[] declaredConstructors = this.scriptExceptionClass.getDeclaredConstructors();

        // basic check for a number of declared constructors
        assertEquals(declaredConstructors.length, 4, "only 4 constructors should be set");

        // check if all declared constructors exists
        for (Constructor<?> declaredConstructor : declaredConstructors) {
            String constructorName = declaredConstructor.getName();
            String constructorString = declaredConstructor.toString();
            assertTrue(testedConstructors.containsKey(constructorString), "wrong constructor.toString() " + constructorName);
            assertEquals(testedConstructors.get(constructorString), constructorName, "wrong constructor name " + constructorName);
        }
    }

    /**
     * Test for method javax.script.ScriptException.getClass().getConstructor()
     */
    protected void testGetConstructor() {
        // following constructors should exist
        Map<String, Class[]> constructorsThatShouldExist_jdk6 = new TreeMap<String, Class[]>();
        constructorsThatShouldExist_jdk6.put("javax.script.ScriptException", new Class[] {java.lang.String.class});
        constructorsThatShouldExist_jdk6.put("javax.script.ScriptException", new Class[] {java.lang.Exception.class});
        constructorsThatShouldExist_jdk6.put("javax.script.ScriptException", new Class[] {java.lang.String.class, java.lang.String.class, int.class});
        constructorsThatShouldExist_jdk6.put("javax.script.ScriptException", new Class[] {java.lang.String.class, java.lang.String.class, int.class, int.class});

        Map<String, Class[]> constructorsThatShouldExist_jdk7 = new TreeMap<String, Class[]>();
        constructorsThatShouldExist_jdk7.put("javax.script.ScriptException", new Class[] {java.lang.String.class, java.lang.String.class, int.class, int.class});
        constructorsThatShouldExist_jdk7.put("javax.script.ScriptException", new Class[] {java.lang.String.class, java.lang.String.class, int.class});
        constructorsThatShouldExist_jdk7.put("javax.script.ScriptException", new Class[] {java.lang.Exception.class});
        constructorsThatShouldExist_jdk7.put("javax.script.ScriptException", new Class[] {java.lang.String.class});

        Map<String, Class[]> constructorsThatShouldExist_jdk8 = new TreeMap<String, Class[]>();
        constructorsThatShouldExist_jdk8.put("javax.script.ScriptException", new Class[] {java.lang.String.class});
        constructorsThatShouldExist_jdk8.put("javax.script.ScriptException", new Class[] {java.lang.String.class, java.lang.String.class, int.class, int.class});
        constructorsThatShouldExist_jdk8.put("javax.script.ScriptException", new Class[] {java.lang.String.class, java.lang.String.class, int.class});
        constructorsThatShouldExist_jdk8.put("javax.script.ScriptException", new Class[] {java.lang.Exception.class});

        Map<String, Class[]> constructorsThatShouldExist = null;
        switch (getJavaVersion()) {
            case 6:
                constructorsThatShouldExist = constructorsThatShouldExist_jdk6;
                break;
            case 7:
                constructorsThatShouldExist = constructorsThatShouldExist_jdk7;
                break;
            case 8:
                constructorsThatShouldExist = constructorsThatShouldExist_jdk8;
                break;
        }

        // check if all required constructors really exist
        for (Map.Entry<String, Class[]> constructorThatShouldExists : constructorsThatShouldExist.entrySet()) {
            try {
                Constructor constructor = this.scriptExceptionClass.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.ScriptException.getClass().getDeclaredConstructor()
     */
    protected void testGetDeclaredConstructor() {
        // following constructors should exist
        Map<String, Class[]> constructorsThatShouldExist_jdk6 = new TreeMap<String, Class[]>();
        constructorsThatShouldExist_jdk6.put("javax.script.ScriptException", new Class[] {java.lang.String.class});
        constructorsThatShouldExist_jdk6.put("javax.script.ScriptException", new Class[] {java.lang.Exception.class});
        constructorsThatShouldExist_jdk6.put("javax.script.ScriptException", new Class[] {java.lang.String.class, java.lang.String.class, int.class});
        constructorsThatShouldExist_jdk6.put("javax.script.ScriptException", new Class[] {java.lang.String.class, java.lang.String.class, int.class, int.class});

        Map<String, Class[]> constructorsThatShouldExist_jdk7 = new TreeMap<String, Class[]>();
        constructorsThatShouldExist_jdk7.put("javax.script.ScriptException", new Class[] {java.lang.String.class, java.lang.String.class, int.class, int.class});
        constructorsThatShouldExist_jdk7.put("javax.script.ScriptException", new Class[] {java.lang.String.class, java.lang.String.class, int.class});
        constructorsThatShouldExist_jdk7.put("javax.script.ScriptException", new Class[] {java.lang.Exception.class});
        constructorsThatShouldExist_jdk7.put("javax.script.ScriptException", new Class[] {java.lang.String.class});

        Map<String, Class[]> constructorsThatShouldExist_jdk8 = new TreeMap<String, Class[]>();
        constructorsThatShouldExist_jdk8.put("javax.script.ScriptException", new Class[] {java.lang.String.class});
        constructorsThatShouldExist_jdk8.put("javax.script.ScriptException", new Class[] {java.lang.String.class, java.lang.String.class, int.class, int.class});
        constructorsThatShouldExist_jdk8.put("javax.script.ScriptException", new Class[] {java.lang.String.class, java.lang.String.class, int.class});
        constructorsThatShouldExist_jdk8.put("javax.script.ScriptException", new Class[] {java.lang.Exception.class});

        Map<String, Class[]> constructorsThatShouldExist = null;
        switch (getJavaVersion()) {
            case 6:
                constructorsThatShouldExist = constructorsThatShouldExist_jdk6;
                break;
            case 7:
                constructorsThatShouldExist = constructorsThatShouldExist_jdk7;
                break;
            case 8:
                constructorsThatShouldExist = constructorsThatShouldExist_jdk8;
                break;
        }

        // check if all required constructors really exist
        for (Map.Entry<String, Class[]> constructorThatShouldExists : constructorsThatShouldExist.entrySet()) {
            try {
                Constructor constructor = this.scriptExceptionClass.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.ScriptException.getClass().getFields()
     */
    protected void testGetFields() {
        // following fields should exists
        final String[] fieldsThatShouldExist_jdk6 = {
        };
        final String[] fieldsThatShouldExist_jdk7 = {
        };
        final String[] fieldsThatShouldExist_jdk8 = {
        };

        // get the right array of field signatures
        String[] fieldsThatShouldExist = null;
        switch (getJavaVersion()) {
            case 6:
                fieldsThatShouldExist = fieldsThatShouldExist_jdk6;
                break;
            case 7:
                fieldsThatShouldExist = fieldsThatShouldExist_jdk7;
                break;
            case 8:
                fieldsThatShouldExist = fieldsThatShouldExist_jdk8;
                break;
        }

        // get all fields
        Field[] fields = this.scriptExceptionClass.getFields();
        // and transform the array into a list of field names
        List<String> fieldsAsString = new ArrayList<String>();
        for (Field field : fields) {
            fieldsAsString.add(field.toString());
        }
        // check if all required fields really exists
        for (String fieldThatShouldExists : fieldsThatShouldExist) {
            assertTrue(fieldsAsString.contains(fieldThatShouldExists),
                    "field " + fieldThatShouldExists + " not found");
        }
    }

    /**
     * Test for method javax.script.ScriptException.getClass().getDeclaredFields()
     */
    protected void testGetDeclaredFields() {
        // following declared fields should exists
        final String[] declaredFieldsThatShouldExist_jdk6 = {
            "private java.lang.String javax.script.ScriptException.fileName",
            "private int javax.script.ScriptException.lineNumber",
            "private int javax.script.ScriptException.columnNumber",
        };
        final String[] declaredFieldsThatShouldExist_jdk7 = {
            "private java.lang.String javax.script.ScriptException.fileName",
            "private int javax.script.ScriptException.lineNumber",
            "private int javax.script.ScriptException.columnNumber",
        };
        final String[] declaredFieldsThatShouldExist_jdk8 = {
            "private static final long javax.script.ScriptException.serialVersionUID",
            "private java.lang.String javax.script.ScriptException.fileName",
            "private int javax.script.ScriptException.lineNumber",
            "private int javax.script.ScriptException.columnNumber",
        };

        // get the right array of field signatures
        // following fields should be declared
        String[] declaredFieldsThatShouldExist = null;
        switch (getJavaVersion()) {
            case 6:
                declaredFieldsThatShouldExist = declaredFieldsThatShouldExist_jdk6;
                break;
            case 7:
                declaredFieldsThatShouldExist = declaredFieldsThatShouldExist_jdk7;
                break;
            case 8:
                declaredFieldsThatShouldExist = declaredFieldsThatShouldExist_jdk8;
                break;
        }

        // get all declared fields
        Field[] declaredFields = this.scriptExceptionClass.getDeclaredFields();
        // and transform the array into a list of field names
        List<String> declaredFieldsAsString = new ArrayList<String>();
        for (Field field : declaredFields) {
            declaredFieldsAsString.add(field.toString());
        }
        // check if all required fields really exists
        for (String declaredFieldThatShouldExists : declaredFieldsThatShouldExist) {
            assertTrue(declaredFieldsAsString.contains(declaredFieldThatShouldExists),
                    "field " + declaredFieldThatShouldExists + " not found");
        }
    }

    /**
     * Test for method javax.script.ScriptException.getClass().getField()
     */
    protected void testGetField() {
        // following fields should exists
        final String[] fieldsThatShouldExist_jdk6 = {
        };
        final String[] fieldsThatShouldExist_jdk7 = {
        };
        final String[] fieldsThatShouldExist_jdk8 = {
        };

        String[] fieldsThatShouldExist = null;
        switch (getJavaVersion()) {
            case 6:
                fieldsThatShouldExist = fieldsThatShouldExist_jdk6;
                break;
            case 7:
                fieldsThatShouldExist = fieldsThatShouldExist_jdk7;
                break;
            case 8:
                fieldsThatShouldExist = fieldsThatShouldExist_jdk8;
                break;
        }

        // check if all required fields really exists
        for (String fieldThatShouldExists : fieldsThatShouldExist) {
            try {
                Field field = this.scriptExceptionClass.getField(fieldThatShouldExists);
                String fieldName = field.getName();
                assertTrue(fieldName.equals(fieldThatShouldExists),
                        "field " + fieldThatShouldExists + " not found");
            }
            catch (Exception e) {
                e.printStackTrace();
                throw new AssertionError(e.getMessage());
            }
        }
    }

    /**
     * Test for method javax.script.ScriptException.getClass().getDeclaredField()
     */
    protected void testGetDeclaredField() {
        // following declared fields should exists
        final String[] declaredFieldsThatShouldExist_jdk6 = {
            "fileName",
            "lineNumber",
            "columnNumber",
        };
        final String[] declaredFieldsThatShouldExist_jdk7 = {
            "fileName",
            "lineNumber",
            "columnNumber",
        };
        final String[] declaredFieldsThatShouldExist_jdk8 = {
            "serialVersionUID",
            "fileName",
            "lineNumber",
            "columnNumber",
        };

        // get the right array of field signatures
        // following fields should be declared
        String[] declaredFieldsThatShouldExist = null;
        switch (getJavaVersion()) {
            case 6:
                declaredFieldsThatShouldExist = declaredFieldsThatShouldExist_jdk6;
                break;
            case 7:
                declaredFieldsThatShouldExist = declaredFieldsThatShouldExist_jdk7;
                break;
            case 8:
                declaredFieldsThatShouldExist = declaredFieldsThatShouldExist_jdk8;
                break;
        }

        // check if all required declared fields really exists
        for (String declaredFieldThatShouldExists : declaredFieldsThatShouldExist) {
            try {
                Field field = this.scriptExceptionClass.getDeclaredField(declaredFieldThatShouldExists);
                String fieldName = field.getName();
                assertTrue(fieldName.equals(declaredFieldThatShouldExists),
                        "field " + declaredFieldThatShouldExists + " not found");
            }
            catch (Exception e) {
                e.printStackTrace();
                throw new AssertionError(e.getMessage());
            }
        }
    }

    /**
     * Test for method javax.script.ScriptException.getClass().getMethods()
     */
    protected void testGetMethods() {
        // following methods should be inherited
        final String[] methodsThatShouldExist_jdk6 = {
            "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 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 native 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_jdk7 = {
            "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 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",
            "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.fillInStackTrace()",
            "public synchronized java.lang.Throwable java.lang.Throwable.getCause()",
            "public synchronized java.lang.Throwable java.lang.Throwable.initCause(java.lang.Throwable)",
            "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[])",
        };

        // get all inherited methods
        Method[] methods = this.scriptExceptionClass.getMethods();
        // and transform the array into a list of method names
        List<String> methodsAsString = new ArrayList<String>();
        for (Method method : methods) {
            methodsAsString.add(method.toString());
        }

        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),
                    "method " + methodThatShouldExists + " not found");
        }
    }

    /**
     * Test for method javax.script.ScriptException.getClass().getDeclaredMethods()
     */
    protected void testGetDeclaredMethods() {
        // following methods should be declared
        final String[] declaredMethodsThatShouldExist_jdk6 = {
            "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()",
        };

        final String[] declaredMethodsThatShouldExist_jdk7 = {
            "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()",
        };

        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
        List<String> methodsAsString = new ArrayList<String>();
        for (Method method : declaredMethods) {
            methodsAsString.add(method.toString());
        }

        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),
                    "declared method " + methodThatShouldExists + " not found");
        }
    }

    /**
     * Test for method javax.script.ScriptException.getClass().getMethod()
     */
    protected void testGetMethod() throws ClassNotFoundException {
        // following methods should exist
        Map<String, Class[]> methodsThatShouldExist_jdk6 = new TreeMap<String, Class[]>();
        methodsThatShouldExist_jdk6.put("getMessage", new Class[] {});
        methodsThatShouldExist_jdk6.put("getFileName", new Class[] {});
        methodsThatShouldExist_jdk6.put("getLineNumber", new Class[] {});
        methodsThatShouldExist_jdk6.put("getColumnNumber", new Class[] {});
        methodsThatShouldExist_jdk6.put("printStackTrace", new Class[] {});
        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("initCause", new Class[] {java.lang.Throwable.class});
        methodsThatShouldExist_jdk6.put("toString", new Class[] {});
        methodsThatShouldExist_jdk6.put("getLocalizedMessage", new Class[] {});
        methodsThatShouldExist_jdk6.put("getStackTrace", new Class[] {});
        methodsThatShouldExist_jdk6.put("setStackTrace", new Class[] {Class.forName("[Ljava.lang.StackTraceElement;")});
        methodsThatShouldExist_jdk6.put("wait", new Class[] {long.class});
        methodsThatShouldExist_jdk6.put("wait", new Class[] {long.class, int.class});
        methodsThatShouldExist_jdk6.put("wait", new Class[] {});
        methodsThatShouldExist_jdk6.put("hashCode", new Class[] {});
        methodsThatShouldExist_jdk6.put("getClass", new Class[] {});
        methodsThatShouldExist_jdk6.put("equals", new Class[] {java.lang.Object.class});
        methodsThatShouldExist_jdk6.put("notify", new Class[] {});
        methodsThatShouldExist_jdk6.put("notifyAll", new Class[] {});

        Map<String, Class[]> methodsThatShouldExist_jdk7 = new TreeMap<String, Class[]>();
        methodsThatShouldExist_jdk7.put("getMessage", new Class[] {});
        methodsThatShouldExist_jdk7.put("getFileName", new Class[] {});
        methodsThatShouldExist_jdk7.put("getLineNumber", new Class[] {});
        methodsThatShouldExist_jdk7.put("getColumnNumber", new Class[] {});
        methodsThatShouldExist_jdk7.put("printStackTrace", new Class[] {});
        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("initCause", new Class[] {java.lang.Throwable.class});
        methodsThatShouldExist_jdk7.put("toString", new Class[] {});
        methodsThatShouldExist_jdk7.put("getLocalizedMessage", new Class[] {});
        methodsThatShouldExist_jdk7.put("getStackTrace", new Class[] {});
        methodsThatShouldExist_jdk7.put("setStackTrace", new Class[] {Class.forName("[Ljava.lang.StackTraceElement;")});
        methodsThatShouldExist_jdk7.put("addSuppressed", new Class[] {java.lang.Throwable.class});
        methodsThatShouldExist_jdk7.put("getSuppressed", new Class[] {});
        methodsThatShouldExist_jdk7.put("wait", new Class[] {long.class, int.class});
        methodsThatShouldExist_jdk7.put("wait", new Class[] {long.class});
        methodsThatShouldExist_jdk7.put("wait", new Class[] {});
        methodsThatShouldExist_jdk7.put("equals", new Class[] {java.lang.Object.class});
        methodsThatShouldExist_jdk7.put("hashCode", new Class[] {});
        methodsThatShouldExist_jdk7.put("getClass", new Class[] {});
        methodsThatShouldExist_jdk7.put("notify", new Class[] {});
        methodsThatShouldExist_jdk7.put("notifyAll", new Class[] {});

        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()) {
            try {
                Method method = this.scriptExceptionClass.getMethod(methodThatShouldExists.getKey(), methodThatShouldExists.getValue());
                assertNotNull(method,
                        "method " + methodThatShouldExists.getKey() + " not found");
                String methodName = method.getName();
                assertNotNull(methodName,
                        "method " + methodThatShouldExists.getKey() + " does not have name assigned");
                assertTrue(methodName.equals(methodThatShouldExists.getKey()),
                        "method " + methodThatShouldExists.getKey() + " not found");
            }
            catch (Exception e) {
                e.printStackTrace();
                throw new AssertionError(e.getMessage());
            }
        }
    }

    /**
     * Test for method javax.script.ScriptException.getClass().getDeclaredMethod()
     */
    protected void testGetDeclaredMethod() {
        // following methods should exist
        Map<String, Class[]> methodsThatShouldExist_jdk6 = new TreeMap<String, Class[]>();
        methodsThatShouldExist_jdk6.put("getMessage", new Class[] {});
        methodsThatShouldExist_jdk6.put("getFileName", new Class[] {});
        methodsThatShouldExist_jdk6.put("getLineNumber", new Class[] {});
        methodsThatShouldExist_jdk6.put("getColumnNumber", new Class[] {});

        Map<String, Class[]> methodsThatShouldExist_jdk7 = new TreeMap<String, Class[]>();
        methodsThatShouldExist_jdk7.put("getMessage", new Class[] {});
        methodsThatShouldExist_jdk7.put("getFileName", new Class[] {});
        methodsThatShouldExist_jdk7.put("getLineNumber", new Class[] {});
        methodsThatShouldExist_jdk7.put("getColumnNumber", new Class[] {});

        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()) {
            try {
                Method method = this.scriptExceptionClass.getDeclaredMethod(methodThatShouldExists.getKey(), methodThatShouldExists.getValue());
                assertNotNull(method,
                        "method " + methodThatShouldExists.getKey() + " not found");
                String methodName = method.getName();
                assertNotNull(methodName,
                        "method " + methodThatShouldExists.getKey() + " does not have name assigned");
                assertTrue(methodName.equals(methodThatShouldExists.getKey()),
                        "method " + methodThatShouldExists.getKey() + " not found");
            }
            catch (Exception e) {
                e.printStackTrace();
                throw new AssertionError(e.getMessage());
            }
        }
    }

    /**
     * Test for method javax.script.ScriptException.getClass().getAnnotations()
     */
    protected void testGetAnnotations() {
        // following annotations should be provided
        final String[] annotationsThatShouldExists_jdk6 = {
            // this should be really empty
        };

        final String[] annotationsThatShouldExists_jdk7 = {
            // this should be really empty
        };

        final String[] annotationsThatShouldExists_jdk8 = {
            // this should be really empty
        };

        // get all annotations
        Annotation[] annotations = this.scriptExceptionClass.getAnnotations();
        // 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 = 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),
                    "annotation " + annotationThatShouldExists + " not found");
        }
    }

    /**
     * Test for method javax.script.ScriptException.getClass().getDeclaredAnnotations()
     */
    protected void testGetDeclaredAnnotations() {
        // following annotations should be provided
        final String[] annotationsThatShouldExists_jdk6 = {
        };

        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
        List<String> annotationsAsString = new ArrayList<String>();
        for (Annotation annotation : annotations) {
            annotationsAsString.add(annotation.toString());
        }

        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),
                    "annotation " + annotationThatShouldExists + " not found");
        }
    }

    /**
     * Test for method javax.script.ScriptException.getClass().getAnnotation()
     */
    protected void testGetAnnotation() {
        Annotation annotation;
        annotation = this.scriptExceptionClass.getAnnotation(java.lang.annotation.Annotation.class);
        assertNull(annotation, "annotation java.lang.annotation.Annotation should not be returned");
        annotation = this.scriptExceptionClass.getAnnotation(java.lang.annotation.Documented.class);
        assertNull(annotation, "annotation java.lang.annotation.Documented should not be returned");
        annotation = this.scriptExceptionClass.getAnnotation(java.lang.annotation.Inherited.class);
        assertNull(annotation, "annotation java.lang.annotation.Inherited should not be returned");
        annotation = this.scriptExceptionClass.getAnnotation(java.lang.annotation.Retention.class);
        assertNull(annotation, "annotation java.lang.annotation.Retention should not be returned");
        annotation = this.scriptExceptionClass.getAnnotation(java.lang.annotation.Target.class);
        assertNull(annotation, "annotation java.lang.annotation.Target should not be returned");
        annotation = this.scriptExceptionClass.getAnnotation(java.lang.Deprecated.class);
        assertNull(annotation, "annotation java.lang.Deprecated should not be returned");
        annotation = this.scriptExceptionClass.getAnnotation(java.lang.Override.class);
        assertNull(annotation, "annotation java.lang.Override should not be returned");
        annotation = this.scriptExceptionClass.getAnnotation(java.lang.SuppressWarnings.class);
        assertNull(annotation, "annotation java.lang.SuppressWarnings should not be returned");
    }

    /**
     * Test for method javax.script.ScriptException.getClass().getComponentType()
     */
    protected void testGetComponentType() {
        Class<?> cls = this.scriptExceptionClass.getComponentType();
        assertNull(cls, "getComponentType() should returns null");
    }

    /**
     * Test for method javax.script.ScriptException.getClass().getClasses()
     */
    protected void testGetClasses() {
        Class<?>[] cls = this.scriptExceptionClass.getClasses();
        assertNotNull(cls, "getClasses() returns null");
        assertEquals(cls.length, 0, "getClasses() returns wrong value!");
    }

    /**
     * Test for method javax.script.ScriptException.getClass().getDeclaredClasses()
     */
    protected void testGetDeclaredClasses() {
        Class<?>[] cls = this.scriptExceptionClass.getDeclaredClasses();
        assertNotNull(cls, "getDeclaredClasses() returns null");
        assertEquals(cls.length, 0, "getDeclaredClasses() returns wrong value!");
    }

    /**
     * Test for method javax.script.ScriptException.getClass().getDeclaringClass()
     */
    protected void testGetDeclaringClass() {
        Class<?> cls = this.scriptExceptionClass.getDeclaringClass();
        assertNull(cls, "getDeclaringClass() does not return null");
    }

    /**
     * Test for method javax.script.ScriptException.getClass().getEnclosingClass()
     */
    protected void testGetEnclosingClass() {
        Class<?> cls = this.scriptExceptionClass.getEnclosingClass();
        assertNull(cls, "getEnclosingClass() does not return null");
    }

    /**
     * Test for method javax.script.ScriptException.getClass().getEnclosingConstructor()
     */
    protected void testGetEnclosingConstructor() {
        Constructor<?> cons = this.scriptExceptionClass.getEnclosingConstructor();
        assertNull(cons, "getEnclosingConstructor() does not return null");
    }

    /**
     * Test for method javax.script.ScriptException.getClass().getEnclosingMethod()
     */
    protected void testGetEnclosingMethod() {
        Method m = this.scriptExceptionClass.getEnclosingMethod();
        assertNull(m, "getEnclosingMethod() does not return null");
    }

    /**
     * Test for method javax.script.ScriptException.getClass().getGenericSuperclass()
     */
    protected void testGetGenericSuperclass() {
        Type genericSuperclass = this.scriptExceptionClass.getGenericSuperclass();
        assertNotNull(genericSuperclass, "getGenericSuperclass() does not return null");
    }

    /**
     * Test for method javax.script.ScriptException.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.scriptExceptionClass.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.ScriptException.getClass().getEnumConstants()
     */
    protected void testGetEnumConstants() {
        Object[] enumConstants = this.scriptExceptionClass.getEnumConstants();
        assertNull(enumConstants, "getEnumConstants() does not return null");
    }

    /**
     * Test for method javax.script.ScriptException.getClass().getTypeParameters()
     */
    protected void testGetTypeParameters() {
        TypeVariable<?>[] typeParameters = this.scriptExceptionClass.getTypeParameters();
        assertNotNull(typeParameters, "getTypeParameters() return null");
        assertEquals(0, typeParameters.length, "array of wrong size returned by getTypeParameters() " + typeParameters.length);
    }

    /**
     * Test for method javax.script.ScriptException.getClass().getSigners()
     */
    protected void testGetSigners() {
        Object[] signers = this.scriptExceptionClass.getSigners();
        assertNull(signers, "getSigners() does not return null");
    }

    /**
     * Test for method javax.script.ScriptException.getClass().desiredAssertionStatus()
     */
    protected void testDesiredAssertionStatus() {
        assertFalse(this.scriptExceptionClass.desiredAssertionStatus(),
                "Method ScriptException.getClass().desiredAssertionStatus() returns wrong value");
    }

    /**
     * Test for method javax.script.ScriptException.getClass().asSubclass()
     */
    protected void testAsSubclass() {
        try {
            this.scriptExceptionClass.asSubclass(scriptExceptionClass);
        }
        catch (Exception e) {
            e.printStackTrace();
            throw new AssertionError(e.getMessage());
        }

        try {
            this.scriptExceptionClass.asSubclass(Exception.class);
        }
        catch (Exception e) {
            e.printStackTrace();
            throw new AssertionError(e.getMessage());
        }

        try {
            this.scriptExceptionClass.asSubclass(Throwable.class);
        }
        catch (Exception e) {
            e.printStackTrace();
            throw new AssertionError(e.getMessage());
        }

        try {
            this.scriptExceptionClass.asSubclass(Object.class);
        }
        catch (Exception e) {
            e.printStackTrace();
            throw new AssertionError(e.getMessage());
        }

        try {
            this.scriptExceptionClass.asSubclass(java.lang.Void.class);
            throw new AssertionError("Class.asSubclass(java.lang.Void.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.lang.Number.class);
            throw new AssertionError("Class.asSubclass(java.lang.Number.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.lang.Byte.class);
            throw new AssertionError("Class.asSubclass(java.lang.Byte.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.lang.Double.class);
            throw new AssertionError("Class.asSubclass(java.lang.Double.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.lang.Float.class);
            throw new AssertionError("Class.asSubclass(java.lang.Float.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.lang.Integer.class);
            throw new AssertionError("Class.asSubclass(java.lang.Integer.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.lang.Long.class);
            throw new AssertionError("Class.asSubclass(java.lang.Long.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.lang.Short.class);
            throw new AssertionError("Class.asSubclass(java.lang.Short.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.lang.String.class);
            throw new AssertionError("Class.asSubclass(java.lang.String.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.lang.StringBuffer.class);
            throw new AssertionError("Class.asSubclass(java.lang.StringBuffer.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.lang.StringBuilder.class);
            throw new AssertionError("Class.asSubclass(java.lang.StringBuilder.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.applet.Applet.class);
            throw new AssertionError("Class.asSubclass(java.applet.Applet.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.awt.Button.class);
            throw new AssertionError("Class.asSubclass(java.awt.Button.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.awt.Canvas.class);
            throw new AssertionError("Class.asSubclass(java.awt.Canvas.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.awt.CardLayout.class);
            throw new AssertionError("Class.asSubclass(java.awt.CardLayout.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.awt.Checkbox.class);
            throw new AssertionError("Class.asSubclass(java.awt.Checkbox.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.awt.Choice.class);
            throw new AssertionError("Class.asSubclass(java.awt.Choice.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.awt.Color.class);
            throw new AssertionError("Class.asSubclass(java.awt.Color.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.awt.Font.class);
            throw new AssertionError("Class.asSubclass(java.awt.Font.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.awt.Image.class);
            throw new AssertionError("Class.asSubclass(java.awt.Image.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.awt.Label.class);
            throw new AssertionError("Class.asSubclass(java.awt.Label.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.awt.List.class);
            throw new AssertionError("Class.asSubclass(java.awt.List.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.awt.Menu.class);
            throw new AssertionError("Class.asSubclass(java.awt.Menu.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.io.File.class);
            throw new AssertionError("Class.asSubclass(java.io.File.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.io.Reader.class);
            throw new AssertionError("Class.asSubclass(java.io.Reader.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.io.Writer.class);
            throw new AssertionError("Class.asSubclass(java.io.Writer.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.io.StringReader.class);
            throw new AssertionError("Class.asSubclass(java.io.StringReader.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.io.StringWriter.class);
            throw new AssertionError("Class.asSubclass(java.io.StringWriter.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.io.InputStream.class);
            throw new AssertionError("Class.asSubclass(java.io.InputStream.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.io.OutputStream.class);
            throw new AssertionError("Class.asSubclass(java.io.OutputStream.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.io.ObjectInputStream.class);
            throw new AssertionError("Class.asSubclass(java.io.ObjectInputStream.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.io.ObjectOutputStream.class);
            throw new AssertionError("Class.asSubclass(java.io.ObjectOutputStream.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.math.BigDecimal.class);
            throw new AssertionError("Class.asSubclass(java.math.BigDecimal.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.math.BigInteger.class);
            throw new AssertionError("Class.asSubclass(java.math.BigInteger.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.util.ArrayList.class);
            throw new AssertionError("Class.asSubclass(java.util.ArrayList.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.util.LinkedList.class);
            throw new AssertionError("Class.asSubclass(java.util.LinkedList.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.util.HashMap.class);
            throw new AssertionError("Class.asSubclass(java.util.HashMap.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.util.TreeMap.class);
            throw new AssertionError("Class.asSubclass(java.util.TreeMap.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.util.HashSet.class);
            throw new AssertionError("Class.asSubclass(java.util.HashSet.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.util.TreeSet.class);
            throw new AssertionError("Class.asSubclass(java.util.TreeSet.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.util.Stack.class);
            throw new AssertionError("Class.asSubclass(java.util.Stack.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.util.Vector.class);
            throw new AssertionError("Class.asSubclass(java.util.Vector.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.util.Hashtable.class);
            throw new AssertionError("Class.asSubclass(java.util.Hashtable.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.util.Calendar.class);
            throw new AssertionError("Class.asSubclass(java.util.Calendar.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.util.Arrays.class);
            throw new AssertionError("Class.asSubclass(java.util.Arrays.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(java.util.Collections.class);
            throw new AssertionError("Class.asSubclass(java.util.Collections.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(javax.swing.JPanel.class);
            throw new AssertionError("Class.asSubclass(javax.swing.JPanel.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(javax.swing.JColorChooser.class);
            throw new AssertionError("Class.asSubclass(javax.swing.JColorChooser.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(javax.swing.JScrollBar.class);
            throw new AssertionError("Class.asSubclass(javax.swing.JScrollBar.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.asSubclass(javax.swing.JSlider.class);
            throw new AssertionError("Class.asSubclass(javax.swing.JSlider.class) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

    }

    /**
     * Test for method javax.script.ScriptException.getClass().cast()
     */
    protected void testCast() {
        try {
            this.scriptExceptionClass.cast(new javax.script.ScriptException("script exception"));
        }
        catch (Exception e) {
            e.printStackTrace();
            throw new AssertionError(e.getMessage());
        }

        try {
            this.scriptExceptionClass.cast(new Object());
            throw new AssertionError("Class.cast(new Object()) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.cast(new Object().getClass());
            throw new AssertionError("Class.cast(new Object().getClass()) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.cast(new String());
            throw new AssertionError("Class.cast(new String()) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.cast(Boolean.valueOf(true));
            throw new AssertionError("Class.cast(Boolean.valueOf(true)) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.cast(Boolean.valueOf(false));
            throw new AssertionError("Class.cast(Boolean.valueOf(false)) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.cast(Character.valueOf('a'));
            throw new AssertionError("Class.cast(Character.valueOf('a')) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.cast(Byte.valueOf((byte)42));
            throw new AssertionError("Class.cast(Byte.valueOf((byte)42)) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.cast(Short.valueOf((short)42));
            throw new AssertionError("Class.cast(Short.valueOf((short)42)) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.cast(Integer.valueOf(42));
            throw new AssertionError("Class.cast(Integer.valueOf(42)) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.cast(Long.valueOf(42L));
            throw new AssertionError("Class.cast(Long.valueOf(42L)) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.cast(Float.valueOf(42f));
            throw new AssertionError("Class.cast(Float.valueOf(42f)) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.cast(Double.valueOf(42.));
            throw new AssertionError("Class.cast(Double.valueOf(42.)) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.cast(new Throwable());
            throw new AssertionError("Class.cast(new Throwable()) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.cast(new Throwable("xyzzy"));
            throw new AssertionError("Class.cast(new Throwable(\"xyzzy\")) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.cast(new RuntimeException());
            throw new AssertionError("Class.cast(new RuntimeException()) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.cast(new RuntimeException("xyzzy"));
            throw new AssertionError("Class.cast(new RuntimeException(\"xyzzy\")) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.cast(new Error());
            throw new AssertionError("Class.cast(new Error()) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.cast(new Error("xyzzy"));
            throw new AssertionError("Class.cast(new Error(\"xyzzy\")) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.cast(new java.io.File("xyzzy"));
            throw new AssertionError("Class.cast(new java.io.File(\"xyzzy\")) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.cast(new java.lang.String());
            throw new AssertionError("Class.cast(new java.lang.String()) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.cast(new java.lang.StringBuffer());
            throw new AssertionError("Class.cast(new java.lang.StringBuffer()) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.cast(new java.lang.StringBuilder());
            throw new AssertionError("Class.cast(new java.lang.StringBuilder()) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.cast(java.awt.Color.black);
            throw new AssertionError("Class.cast(java.awt.Color.black) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.cast(new java.awt.Frame());
            throw new AssertionError("Class.cast(new java.awt.Frame()) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.cast(new java.awt.Frame(new String()));
            throw new AssertionError("Class.cast(new java.awt.Frame(new String())) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.cast(new java.awt.Label());
            throw new AssertionError("Class.cast(new java.awt.Label()) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.cast(new java.awt.Label(new String()));
            throw new AssertionError("Class.cast(new java.awt.Label(new String())) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.cast(new java.awt.Label("xyzzy"));
            throw new AssertionError("Class.cast(new java.awt.Label(\"xyzzy\")) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.cast(new javax.swing.JLabel());
            throw new AssertionError("Class.cast(new javax.swing.JLabel()) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.cast(new javax.swing.JLabel(new String()));
            throw new AssertionError("Class.cast(new javax.swing.JLabel(new String())) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.cast(new javax.swing.JLabel("xyzzy"));
            throw new AssertionError("Class.cast(new javax.swing.JLabel(\"xyzzy\")) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

        try {
            this.scriptExceptionClass.cast(new javax.swing.JPanel());
            throw new AssertionError("Class.cast(new javax.swing.JPanel()) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

    }

    /**
     * Test for method javax.script.ScriptException.getClass().newInstance()
     */
    protected void testNewInstance() {
        try {
            Object o = this.scriptExceptionClass.newInstance();
            throw new AssertionError("Class.newInstance() does not throw any exception");
        }
        catch (InstantiationException e) {
            // expected exception
        }
        catch (IllegalAccessException e) {
            // expected exception
        }

    }

    /**
     * Test for method javax.script.ScriptException.getClass().getResourceNPETest()
     */
    protected void testGetResourceNPETest() {
        try {
            Object resource = this.scriptExceptionClass.getResource(null);
            throw new AssertionError("NullPointerException expected!");
        }
        catch (NullPointerException e) {
            //This is OK OK
        }
    }

    /**
     * Test for method javax.script.ScriptException.getClass().getResourceNegativeTest()
     */
    protected void testGetResourceNegativeTest() {
        Object resource = this.scriptExceptionClass.getResource("unknown");
        assertNull(resource, "getResource() does not return null");
    }

    /**
     * Test for method javax.script.ScriptException.getClass().getResourcePositiveTest()
     */
    protected void testGetResourcePositiveTest() {
        Object resource;
        resource = this.scriptExceptionClass.getResource("/org/RhinoTests/AbstractScriptEngineClassTest.class");
        assertNotNull(resource, "getResource(\"/org/RhinoTests/AbstractScriptEngineClassTest.class\") returns null");
        resource = this.scriptExceptionClass.getResource("/org/RhinoTests/BaseRhinoTest.class");
        assertNotNull(resource, "getResource(\"/org/RhinoTests/BaseRhinoTest.class\") returns null");
        resource = this.scriptExceptionClass.getResource("/org/RhinoTests/BindingsClassTest.class");
        assertNotNull(resource, "getResource(\"/org/RhinoTests/BindingsClassTest.class\") returns null");
        resource = this.scriptExceptionClass.getResource("/org/RhinoTests/BindingsTest.class");
        assertNotNull(resource, "getResource(\"/org/RhinoTests/BindingsTest.class\") returns null");
        resource = this.scriptExceptionClass.getResource("/org/RhinoTests/CompilableClassTest.class");
        assertNotNull(resource, "getResource(\"/org/RhinoTests/CompilableClassTest.class\") returns null");
        resource = this.scriptExceptionClass.getResource("/org/RhinoTests/CompilableTest.class");
        assertNotNull(resource, "getResource(\"/org/RhinoTests/CompilableTest.class\") returns null");
        resource = this.scriptExceptionClass.getResource("/org/RhinoTests/CompiledScriptClassTest.class");
        assertNotNull(resource, "getResource(\"/org/RhinoTests/CompiledScriptClassTest.class\") returns null");
        resource = this.scriptExceptionClass.getResource("/org/RhinoTests/CompiledScriptTest.class");
        assertNotNull(resource, "getResource(\"/org/RhinoTests/CompiledScriptTest.class\") returns null");
        resource = this.scriptExceptionClass.getResource("/org/RhinoTests/Constants.class");
        assertNotNull(resource, "getResource(\"/org/RhinoTests/Constants.class\") returns null");
        resource = this.scriptExceptionClass.getResource("/org/RhinoTests/InvocableClassTest.class");
        assertNotNull(resource, "getResource(\"/org/RhinoTests/InvocableClassTest.class\") returns null");
        resource = this.scriptExceptionClass.getResource("/org/RhinoTests/InvocableTest.class");
        assertNotNull(resource, "getResource(\"/org/RhinoTests/InvocableTest.class\") returns null");
        resource = this.scriptExceptionClass.getResource("/org/RhinoTests/JavaScriptSnippets.class");
        assertNotNull(resource, "getResource(\"/org/RhinoTests/JavaScriptSnippets.class\") returns null");
        resource = this.scriptExceptionClass.getResource("/org/RhinoTests/JavaScriptsTest.class");
        assertNotNull(resource, "getResource(\"/org/RhinoTests/JavaScriptsTest.class\") returns null");
        resource = this.scriptExceptionClass.getResource("/org/RhinoTests/ScriptContextClassTest.class");
        assertNotNull(resource, "getResource(\"/org/RhinoTests/ScriptContextClassTest.class\") returns null");
        resource = this.scriptExceptionClass.getResource("/org/RhinoTests/ScriptContextTest.class");
        assertNotNull(resource, "getResource(\"/org/RhinoTests/ScriptContextTest.class\") returns null");
        resource = this.scriptExceptionClass.getResource("/org/RhinoTests/ScriptEngineClassTest.class");
        assertNotNull(resource, "getResource(\"/org/RhinoTests/ScriptEngineClassTest.class\") returns null");
        resource = this.scriptExceptionClass.getResource("/org/RhinoTests/ScriptEngineFactoryClassTest.class");
        assertNotNull(resource, "getResource(\"/org/RhinoTests/ScriptEngineFactoryClassTest.class\") returns null");
        resource = this.scriptExceptionClass.getResource("/org/RhinoTests/ScriptEngineFactoryTest.class");
        assertNotNull(resource, "getResource(\"/org/RhinoTests/ScriptEngineFactoryTest.class\") returns null");
        resource = this.scriptExceptionClass.getResource("/org/RhinoTests/ScriptEngineManagerClassTest.class");
        assertNotNull(resource, "getResource(\"/org/RhinoTests/ScriptEngineManagerClassTest.class\") returns null");
        resource = this.scriptExceptionClass.getResource("/org/RhinoTests/ScriptEngineManagerTest.class");
        assertNotNull(resource, "getResource(\"/org/RhinoTests/ScriptEngineManagerTest.class\") returns null");
        resource = this.scriptExceptionClass.getResource("/org/RhinoTests/ScriptEngineTest.class");
        assertNotNull(resource, "getResource(\"/org/RhinoTests/ScriptEngineTest.class\") returns null");
        resource = this.scriptExceptionClass.getResource("/org/RhinoTests/ScriptExceptionClassTest.class");
        assertNotNull(resource, "getResource(\"/org/RhinoTests/ScriptExceptionClassTest.class\") returns null");
        resource = this.scriptExceptionClass.getResource("/org/RhinoTests/ScriptExceptionTest.class");
        assertNotNull(resource, "getResource(\"/org/RhinoTests/ScriptExceptionTest.class\") returns null");
        resource = this.scriptExceptionClass.getResource("/org/RhinoTests/SimpleBindingsClassTest.class");
        assertNotNull(resource, "getResource(\"/org/RhinoTests/SimpleBindingsClassTest.class\") returns null");
        resource = this.scriptExceptionClass.getResource("/org/RhinoTests/SimpleBindingsTest.class");
        assertNotNull(resource, "getResource(\"/org/RhinoTests/SimpleBindingsTest.class\") returns null");
        resource = this.scriptExceptionClass.getResource("/org/RhinoTests/SimpleScriptContextClassTest.class");
        assertNotNull(resource, "getResource(\"/org/RhinoTests/SimpleScriptContextClassTest.class\") returns null");
        resource = this.scriptExceptionClass.getResource("/org/RhinoTests/SimpleScriptContextTest.class");
        assertNotNull(resource, "getResource(\"/org/RhinoTests/SimpleScriptContextTest.class\") returns null");
    }

    /**
     * Test for instanceof operator applied to a class javax.script.ScriptException
     */
    @SuppressWarnings("cast")
    protected void testInstanceOf() {
        // tested object
        Object o = new ScriptException("script exception");

        // basic check of instanceof operator
        assertTrue(o instanceof ScriptException, "instanceof ScriptException is wrongly evaluated to false");

        // check operator instanceof against all superclasses
        assertTrue(o instanceof Exception, "instanceof Exception is wrongly evaluated to false");
        assertTrue(o instanceof Throwable, "instanceof Throwable is wrongly evaluated to false");
        assertTrue(o instanceof Object, "instanceof Object is wrongly evaluated to false");
    }

    /**
     * Entry point to this test case.
     *
     * @param args parameters passed from command line
     */
    public static void main(String[] args) {
        new ScriptExceptionClassTest().doTests(args);
    }
}