view src/org/RhinoTests/SimpleScriptContextClassTest.java @ 350:2376dfe0bccd draft

Fixed (c) year in SimpleScriptContextClassTest.
author Pavel Tisnovsky <ptisnovs@redhat.com>
date Tue, 08 Apr 2014 09:57:54 +0200
parents d6b53a234aca
children
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.SimpleScriptContext;
import javax.script.ScriptContext;



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

    /**
     * Instance of SimpleScriptContext class
     */
    Object simpleScriptContextInstance = null;

    /**
     * Object that represents the type of one SimpleScriptContext instance.
     */
    Class<?> simpleScriptContextClass = null;

    @Override
    protected void setUp(String[] args) {
        // setup both attributes used by tests
        this.simpleScriptContextInstance = new SimpleScriptContext();
        this.simpleScriptContextClass = this.simpleScriptContextInstance.getClass();
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * Test for method javax.script.SimpleScriptContext.getClass().getInterfaces()
     */
    protected void testGetInterfaces() {
        List<Class<?>> interfaces = Arrays.asList(this.simpleScriptContextClass.getInterfaces());
        assertTrue(interfaces.contains(ScriptContext.class),
                "list of implemented interfaces does not contain ScriptContext");
    }

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

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

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

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

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

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

    /**
     * Test for method javax.script.SimpleScriptContext.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.SimpleScriptContext()", "javax.script.SimpleScriptContext");
        testedConstructors_jdk7.put("public javax.script.SimpleScriptContext()", "javax.script.SimpleScriptContext");
        testedConstructors_jdk8.put("public javax.script.SimpleScriptContext()", "javax.script.SimpleScriptContext");

        // 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.simpleScriptContextClass.getConstructors();

        // basic check for a number of constructors
        assertEquals(constructors.length, 1, "only one constructor 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.SimpleScriptContext.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.SimpleScriptContext()", "javax.script.SimpleScriptContext");
        testedConstructors_jdk7.put("public javax.script.SimpleScriptContext()", "javax.script.SimpleScriptContext");
        testedConstructors_jdk8.put("public javax.script.SimpleScriptContext()", "javax.script.SimpleScriptContext");

        // 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.simpleScriptContextClass.getDeclaredConstructors();

        // basic check for a number of declared constructors
        assertEquals(declaredConstructors.length, 1, "only one constructor 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.SimpleScriptContext.getClass().getConstructor()
     */
    protected void testGetConstructor() {
        // following constructors should exist
        Map<String, Class[]> constructorsThatShouldExist_jdk6 = new TreeMap<String, Class[]>();
        constructorsThatShouldExist_jdk6.put("javax.script.SimpleScriptContext", new Class[] {});

        Map<String, Class[]> constructorsThatShouldExist_jdk7 = new TreeMap<String, Class[]>();
        constructorsThatShouldExist_jdk7.put("javax.script.SimpleScriptContext", new Class[] {});

        Map<String, Class[]> constructorsThatShouldExist_jdk8 = new TreeMap<String, Class[]>();
        constructorsThatShouldExist_jdk8.put("javax.script.SimpleScriptContext", new 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.simpleScriptContextClass.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.SimpleScriptContext.getClass().getDeclaredConstructor()
     */
    protected void testGetDeclaredConstructor() {
        // following constructors should exist
        Map<String, Class[]> constructorsThatShouldExist_jdk6 = new TreeMap<String, Class[]>();
        constructorsThatShouldExist_jdk6.put("javax.script.SimpleScriptContext", new Class[] {});

        Map<String, Class[]> constructorsThatShouldExist_jdk7 = new TreeMap<String, Class[]>();
        constructorsThatShouldExist_jdk7.put("javax.script.SimpleScriptContext", new Class[] {});

        Map<String, Class[]> constructorsThatShouldExist_jdk8 = new TreeMap<String, Class[]>();
        constructorsThatShouldExist_jdk8.put("javax.script.SimpleScriptContext", new 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.simpleScriptContextClass.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.SimpleScriptContext.getClass().getFields()
     */
    protected void testGetFields() {
        // following fields should exists
        final String[] fieldsThatShouldExist_jdk6 = {
            "public static final int javax.script.ScriptContext.ENGINE_SCOPE",
            "public static final int javax.script.ScriptContext.GLOBAL_SCOPE",
        };
        final String[] fieldsThatShouldExist_jdk7 = {
            "public static final int javax.script.ScriptContext.ENGINE_SCOPE",
            "public static final int javax.script.ScriptContext.GLOBAL_SCOPE",
        };
        final String[] fieldsThatShouldExist_jdk8 = {
            "public static final int javax.script.ScriptContext.ENGINE_SCOPE",
            "public static final int javax.script.ScriptContext.GLOBAL_SCOPE",
        };

        // 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.simpleScriptContextClass.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.SimpleScriptContext.getClass().getDeclaredFields()
     */
    protected void testGetDeclaredFields() {
        // following declared fields should exists
        final String[] declaredFieldsThatShouldExist_jdk6 = {
            "protected java.io.Writer javax.script.SimpleScriptContext.writer",
            "protected java.io.Writer javax.script.SimpleScriptContext.errorWriter",
            "protected java.io.Reader javax.script.SimpleScriptContext.reader",
            "protected javax.script.Bindings javax.script.SimpleScriptContext.engineScope",
            "protected javax.script.Bindings javax.script.SimpleScriptContext.globalScope",
            "private static java.util.List javax.script.SimpleScriptContext.scopes",
        };
        final String[] declaredFieldsThatShouldExist_jdk7 = {
            "protected java.io.Writer javax.script.SimpleScriptContext.writer",
            "protected java.io.Writer javax.script.SimpleScriptContext.errorWriter",
            "protected java.io.Reader javax.script.SimpleScriptContext.reader",
            "protected javax.script.Bindings javax.script.SimpleScriptContext.engineScope",
            "protected javax.script.Bindings javax.script.SimpleScriptContext.globalScope",
            "private static java.util.List javax.script.SimpleScriptContext.scopes",
        };
        final String[] declaredFieldsThatShouldExist_jdk8 = {
            "protected java.io.Writer javax.script.SimpleScriptContext.writer",
            "protected java.io.Writer javax.script.SimpleScriptContext.errorWriter",
            "protected java.io.Reader javax.script.SimpleScriptContext.reader",
            "protected javax.script.Bindings javax.script.SimpleScriptContext.engineScope",
            "protected javax.script.Bindings javax.script.SimpleScriptContext.globalScope",
            "private static java.util.List javax.script.SimpleScriptContext.scopes",
        };

        // 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.simpleScriptContextClass.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.SimpleScriptContext.getClass().getField()
     */
    protected void testGetField() {
        // following fields should exists
        final String[] fieldsThatShouldExist_jdk6 = {
            "ENGINE_SCOPE",
            "GLOBAL_SCOPE",
        };
        final String[] fieldsThatShouldExist_jdk7 = {
            "ENGINE_SCOPE",
            "GLOBAL_SCOPE",
        };
        final String[] fieldsThatShouldExist_jdk8 = {
            "ENGINE_SCOPE",
            "GLOBAL_SCOPE",
        };

        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.simpleScriptContextClass.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.SimpleScriptContext.getClass().getDeclaredField()
     */
    protected void testGetDeclaredField() {
        // following declared fields should exists
        final String[] declaredFieldsThatShouldExist_jdk6 = {
            "writer",
            "errorWriter",
            "reader",
            "engineScope",
            "globalScope",
            "scopes",
        };
        final String[] declaredFieldsThatShouldExist_jdk7 = {
            "writer",
            "errorWriter",
            "reader",
            "engineScope",
            "globalScope",
            "scopes",
        };
        final String[] declaredFieldsThatShouldExist_jdk8 = {
            "writer",
            "errorWriter",
            "reader",
            "engineScope",
            "globalScope",
            "scopes",
        };

        // 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.simpleScriptContextClass.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.SimpleScriptContext.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.SimpleScriptContext.getAttributesScope(java.lang.String)",
            "public java.io.Reader javax.script.SimpleScriptContext.getReader()",
            "public java.io.Writer javax.script.SimpleScriptContext.getErrorWriter()",
            "public java.io.Writer javax.script.SimpleScriptContext.getWriter()",
            "public java.lang.Object javax.script.SimpleScriptContext.getAttribute(java.lang.String)",
            "public java.lang.Object javax.script.SimpleScriptContext.getAttribute(java.lang.String,int)",
            "public java.lang.Object javax.script.SimpleScriptContext.removeAttribute(java.lang.String,int)",
            "public java.lang.String java.lang.Object.toString()",
            "public java.util.List javax.script.SimpleScriptContext.getScopes()",
            "public javax.script.Bindings javax.script.SimpleScriptContext.getBindings(int)",
            "public native int java.lang.Object.hashCode()",
            "public void javax.script.SimpleScriptContext.setAttribute(java.lang.String,java.lang.Object,int)",
            "public void javax.script.SimpleScriptContext.setBindings(javax.script.Bindings,int)",
            "public void javax.script.SimpleScriptContext.setErrorWriter(java.io.Writer)",
            "public void javax.script.SimpleScriptContext.setReader(java.io.Reader)",
            "public void javax.script.SimpleScriptContext.setWriter(java.io.Writer)",
        };

        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.SimpleScriptContext.getAttributesScope(java.lang.String)",
            "public java.io.Reader javax.script.SimpleScriptContext.getReader()",
            "public java.io.Writer javax.script.SimpleScriptContext.getErrorWriter()",
            "public java.io.Writer javax.script.SimpleScriptContext.getWriter()",
            "public java.lang.Object javax.script.SimpleScriptContext.getAttribute(java.lang.String)",
            "public java.lang.Object javax.script.SimpleScriptContext.getAttribute(java.lang.String,int)",
            "public java.lang.Object javax.script.SimpleScriptContext.removeAttribute(java.lang.String,int)",
            "public java.lang.String java.lang.Object.toString()",
            "public java.util.List javax.script.SimpleScriptContext.getScopes()",
            "public javax.script.Bindings javax.script.SimpleScriptContext.getBindings(int)",
            "public native int java.lang.Object.hashCode()",
            "public void javax.script.SimpleScriptContext.setAttribute(java.lang.String,java.lang.Object,int)",
            "public void javax.script.SimpleScriptContext.setBindings(javax.script.Bindings,int)",
            "public void javax.script.SimpleScriptContext.setErrorWriter(java.io.Writer)",
            "public void javax.script.SimpleScriptContext.setReader(java.io.Reader)",
            "public void javax.script.SimpleScriptContext.setWriter(java.io.Writer)",
        };

        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 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.SimpleScriptContext.getAttributesScope(java.lang.String)",
            "public java.io.Reader javax.script.SimpleScriptContext.getReader()",
            "public java.io.Writer javax.script.SimpleScriptContext.getErrorWriter()",
            "public java.io.Writer javax.script.SimpleScriptContext.getWriter()",
            "public java.lang.Object javax.script.SimpleScriptContext.getAttribute(java.lang.String)",
            "public java.lang.Object javax.script.SimpleScriptContext.getAttribute(java.lang.String,int)",
            "public java.lang.Object javax.script.SimpleScriptContext.removeAttribute(java.lang.String,int)",
            "public java.lang.String java.lang.Object.toString()",
            "public java.util.List javax.script.SimpleScriptContext.getScopes()",
            "public javax.script.Bindings javax.script.SimpleScriptContext.getBindings(int)",
            "public native int java.lang.Object.hashCode()",
            "public void javax.script.SimpleScriptContext.setAttribute(java.lang.String,java.lang.Object,int)",
            "public void javax.script.SimpleScriptContext.setBindings(javax.script.Bindings,int)",
            "public void javax.script.SimpleScriptContext.setErrorWriter(java.io.Writer)",
            "public void javax.script.SimpleScriptContext.setReader(java.io.Reader)",
            "public void javax.script.SimpleScriptContext.setWriter(java.io.Writer)",
        };

        // get all inherited methods
        Method[] methods = this.simpleScriptContextClass.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.SimpleScriptContext.getClass().getDeclaredMethods()
     */
    protected void testGetDeclaredMethods() {
        // following methods should be declared
        final String[] declaredMethodsThatShouldExist_jdk6 = {
            "public int javax.script.SimpleScriptContext.getAttributesScope(java.lang.String)",
            "public java.io.Reader javax.script.SimpleScriptContext.getReader()",
            "public java.io.Writer javax.script.SimpleScriptContext.getErrorWriter()",
            "public java.io.Writer javax.script.SimpleScriptContext.getWriter()",
            "public java.lang.Object javax.script.SimpleScriptContext.getAttribute(java.lang.String)",
            "public java.lang.Object javax.script.SimpleScriptContext.getAttribute(java.lang.String,int)",
            "public java.lang.Object javax.script.SimpleScriptContext.removeAttribute(java.lang.String,int)",
            "public java.util.List javax.script.SimpleScriptContext.getScopes()",
            "public javax.script.Bindings javax.script.SimpleScriptContext.getBindings(int)",
            "public void javax.script.SimpleScriptContext.setAttribute(java.lang.String,java.lang.Object,int)",
            "public void javax.script.SimpleScriptContext.setBindings(javax.script.Bindings,int)",
            "public void javax.script.SimpleScriptContext.setErrorWriter(java.io.Writer)",
            "public void javax.script.SimpleScriptContext.setReader(java.io.Reader)",
            "public void javax.script.SimpleScriptContext.setWriter(java.io.Writer)",
        };

        final String[] declaredMethodsThatShouldExist_jdk7 = {
            "public int javax.script.SimpleScriptContext.getAttributesScope(java.lang.String)",
            "public java.io.Reader javax.script.SimpleScriptContext.getReader()",
            "public java.io.Writer javax.script.SimpleScriptContext.getErrorWriter()",
            "public java.io.Writer javax.script.SimpleScriptContext.getWriter()",
            "public java.lang.Object javax.script.SimpleScriptContext.getAttribute(java.lang.String)",
            "public java.lang.Object javax.script.SimpleScriptContext.getAttribute(java.lang.String,int)",
            "public java.lang.Object javax.script.SimpleScriptContext.removeAttribute(java.lang.String,int)",
            "public java.util.List javax.script.SimpleScriptContext.getScopes()",
            "public javax.script.Bindings javax.script.SimpleScriptContext.getBindings(int)",
            "public void javax.script.SimpleScriptContext.setAttribute(java.lang.String,java.lang.Object,int)",
            "public void javax.script.SimpleScriptContext.setBindings(javax.script.Bindings,int)",
            "public void javax.script.SimpleScriptContext.setErrorWriter(java.io.Writer)",
            "public void javax.script.SimpleScriptContext.setReader(java.io.Reader)",
            "public void javax.script.SimpleScriptContext.setWriter(java.io.Writer)",
        };

        final String[] declaredMethodsThatShouldExist_jdk8 = {
            "public int javax.script.SimpleScriptContext.getAttributesScope(java.lang.String)",
            "public java.io.Reader javax.script.SimpleScriptContext.getReader()",
            "public java.io.Writer javax.script.SimpleScriptContext.getErrorWriter()",
            "public java.io.Writer javax.script.SimpleScriptContext.getWriter()",
            "public java.lang.Object javax.script.SimpleScriptContext.getAttribute(java.lang.String)",
            "public java.lang.Object javax.script.SimpleScriptContext.getAttribute(java.lang.String,int)",
            "public java.lang.Object javax.script.SimpleScriptContext.removeAttribute(java.lang.String,int)",
            "public java.util.List javax.script.SimpleScriptContext.getScopes()",
            "public javax.script.Bindings javax.script.SimpleScriptContext.getBindings(int)",
            "public void javax.script.SimpleScriptContext.setAttribute(java.lang.String,java.lang.Object,int)",
            "public void javax.script.SimpleScriptContext.setBindings(javax.script.Bindings,int)",
            "public void javax.script.SimpleScriptContext.setErrorWriter(java.io.Writer)",
            "public void javax.script.SimpleScriptContext.setReader(java.io.Reader)",
            "public void javax.script.SimpleScriptContext.setWriter(java.io.Writer)",
        };

        // get all declared methods
        Method[] declaredMethods = this.simpleScriptContextClass.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.SimpleScriptContext.getClass().getMethod()
     */
    protected void testGetMethod() {
        // following methods should exist
        Map<String, Class[]> methodsThatShouldExist_jdk6 = new TreeMap<String, Class[]>();
        methodsThatShouldExist_jdk6.put("setBindings", new Class[] {javax.script.Bindings.class, int.class});
        methodsThatShouldExist_jdk6.put("getBindings", new Class[] {int.class});
        methodsThatShouldExist_jdk6.put("getWriter", new Class[] {});
        methodsThatShouldExist_jdk6.put("setWriter", new Class[] {java.io.Writer.class});
        methodsThatShouldExist_jdk6.put("getReader", new Class[] {});
        methodsThatShouldExist_jdk6.put("setReader", new Class[] {java.io.Reader.class});
        methodsThatShouldExist_jdk6.put("getErrorWriter", new Class[] {});
        methodsThatShouldExist_jdk6.put("setErrorWriter", new Class[] {java.io.Writer.class});
        methodsThatShouldExist_jdk6.put("setAttribute", new Class[] {java.lang.String.class, java.lang.Object.class, int.class});
        methodsThatShouldExist_jdk6.put("getAttribute", new Class[] {java.lang.String.class});
        methodsThatShouldExist_jdk6.put("getAttribute", new Class[] {java.lang.String.class, int.class});
        methodsThatShouldExist_jdk6.put("removeAttribute", new Class[] {java.lang.String.class, int.class});
        methodsThatShouldExist_jdk6.put("getAttributesScope", new Class[] {java.lang.String.class});
        methodsThatShouldExist_jdk6.put("getScopes", new Class[] {});
        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("toString", new 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("getErrorWriter", new Class[] {});
        methodsThatShouldExist_jdk7.put("getBindings", new Class[] {int.class});
        methodsThatShouldExist_jdk7.put("getReader", new Class[] {});
        methodsThatShouldExist_jdk7.put("getWriter", new Class[] {});
        methodsThatShouldExist_jdk7.put("setBindings", new Class[] {javax.script.Bindings.class, int.class});
        methodsThatShouldExist_jdk7.put("setErrorWriter", new Class[] {java.io.Writer.class});
        methodsThatShouldExist_jdk7.put("setReader", new Class[] {java.io.Reader.class});
        methodsThatShouldExist_jdk7.put("setWriter", new Class[] {java.io.Writer.class});
        methodsThatShouldExist_jdk7.put("getAttribute", new Class[] {java.lang.String.class});
        methodsThatShouldExist_jdk7.put("getAttribute", new Class[] {java.lang.String.class, int.class});
        methodsThatShouldExist_jdk7.put("getAttributesScope", new Class[] {java.lang.String.class});
        methodsThatShouldExist_jdk7.put("getScopes", new Class[] {});
        methodsThatShouldExist_jdk7.put("removeAttribute", new Class[] {java.lang.String.class, int.class});
        methodsThatShouldExist_jdk7.put("setAttribute", new Class[] {java.lang.String.class, java.lang.Object.class, int.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("toString", new 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("setBindings", new Class[] {javax.script.Bindings.class, int.class});
        methodsThatShouldExist_jdk8.put("getBindings", new Class[] {int.class});
        methodsThatShouldExist_jdk8.put("getWriter", new Class[] {});
        methodsThatShouldExist_jdk8.put("setWriter", new Class[] {java.io.Writer.class});
        methodsThatShouldExist_jdk8.put("getReader", new Class[] {});
        methodsThatShouldExist_jdk8.put("setReader", new Class[] {java.io.Reader.class});
        methodsThatShouldExist_jdk8.put("getErrorWriter", new Class[] {});
        methodsThatShouldExist_jdk8.put("setErrorWriter", new Class[] {java.io.Writer.class});
        methodsThatShouldExist_jdk8.put("setAttribute", new Class[] {java.lang.String.class, java.lang.Object.class, int.class});
        methodsThatShouldExist_jdk8.put("getAttribute", new Class[] {java.lang.String.class});
        methodsThatShouldExist_jdk8.put("getAttribute", new Class[] {java.lang.String.class, int.class});
        methodsThatShouldExist_jdk8.put("removeAttribute", new Class[] {java.lang.String.class, int.class});
        methodsThatShouldExist_jdk8.put("getAttributesScope", new Class[] {java.lang.String.class});
        methodsThatShouldExist_jdk8.put("getScopes", 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("toString", new Class[] {});
        methodsThatShouldExist_jdk8.put("hashCode", new Class[] {});
        methodsThatShouldExist_jdk8.put("getClass", new Class[] {});
        methodsThatShouldExist_jdk8.put("notify", new Class[] {});
        methodsThatShouldExist_jdk8.put("notifyAll", new Class[] {});

        Map<String, Class[]> methodsThatShouldExist = null;
        switch (getJavaVersion()) {
            case 6:
                methodsThatShouldExist = methodsThatShouldExist_jdk6;
                break;
            case 7:
                methodsThatShouldExist = methodsThatShouldExist_jdk7;
                break;
            case 8:
                methodsThatShouldExist = methodsThatShouldExist_jdk8;
                break;
        }

        // check if all required methods really exist
        for (Map.Entry<String, Class[]> methodThatShouldExists : methodsThatShouldExist.entrySet()) {
            try {
                Method method = this.simpleScriptContextClass.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.SimpleScriptContext.getClass().getDeclaredMethod()
     */
    protected void testGetDeclaredMethod() {
        // following methods should exist
        Map<String, Class[]> methodsThatShouldExist_jdk6 = new TreeMap<String, Class[]>();
        methodsThatShouldExist_jdk6.put("setBindings", new Class[] {javax.script.Bindings.class, int.class});
        methodsThatShouldExist_jdk6.put("getBindings", new Class[] {int.class});
        methodsThatShouldExist_jdk6.put("getWriter", new Class[] {});
        methodsThatShouldExist_jdk6.put("setWriter", new Class[] {java.io.Writer.class});
        methodsThatShouldExist_jdk6.put("getReader", new Class[] {});
        methodsThatShouldExist_jdk6.put("setReader", new Class[] {java.io.Reader.class});
        methodsThatShouldExist_jdk6.put("getErrorWriter", new Class[] {});
        methodsThatShouldExist_jdk6.put("setErrorWriter", new Class[] {java.io.Writer.class});
        methodsThatShouldExist_jdk6.put("setAttribute", new Class[] {java.lang.String.class, java.lang.Object.class, int.class});
        methodsThatShouldExist_jdk6.put("getAttribute", new Class[] {java.lang.String.class});
        methodsThatShouldExist_jdk6.put("getAttribute", new Class[] {java.lang.String.class, int.class});
        methodsThatShouldExist_jdk6.put("removeAttribute", new Class[] {java.lang.String.class, int.class});
        methodsThatShouldExist_jdk6.put("getAttributesScope", new Class[] {java.lang.String.class});
        methodsThatShouldExist_jdk6.put("getScopes", new Class[] {});

        Map<String, Class[]> methodsThatShouldExist_jdk7 = new TreeMap<String, Class[]>();
        methodsThatShouldExist_jdk7.put("getErrorWriter", new Class[] {});
        methodsThatShouldExist_jdk7.put("getBindings", new Class[] {int.class});
        methodsThatShouldExist_jdk7.put("getReader", new Class[] {});
        methodsThatShouldExist_jdk7.put("getWriter", new Class[] {});
        methodsThatShouldExist_jdk7.put("setBindings", new Class[] {javax.script.Bindings.class, int.class});
        methodsThatShouldExist_jdk7.put("setErrorWriter", new Class[] {java.io.Writer.class});
        methodsThatShouldExist_jdk7.put("setReader", new Class[] {java.io.Reader.class});
        methodsThatShouldExist_jdk7.put("setWriter", new Class[] {java.io.Writer.class});
        methodsThatShouldExist_jdk7.put("getAttribute", new Class[] {java.lang.String.class});
        methodsThatShouldExist_jdk7.put("getAttribute", new Class[] {java.lang.String.class, int.class});
        methodsThatShouldExist_jdk7.put("getAttributesScope", new Class[] {java.lang.String.class});
        methodsThatShouldExist_jdk7.put("getScopes", new Class[] {});
        methodsThatShouldExist_jdk7.put("removeAttribute", new Class[] {java.lang.String.class, int.class});
        methodsThatShouldExist_jdk7.put("setAttribute", new Class[] {java.lang.String.class, java.lang.Object.class, int.class});

        Map<String, Class[]> methodsThatShouldExist_jdk8 = new TreeMap<String, Class[]>();
        methodsThatShouldExist_jdk8.put("setBindings", new Class[] {javax.script.Bindings.class, int.class});
        methodsThatShouldExist_jdk8.put("getBindings", new Class[] {int.class});
        methodsThatShouldExist_jdk8.put("getWriter", new Class[] {});
        methodsThatShouldExist_jdk8.put("setWriter", new Class[] {java.io.Writer.class});
        methodsThatShouldExist_jdk8.put("getReader", new Class[] {});
        methodsThatShouldExist_jdk8.put("setReader", new Class[] {java.io.Reader.class});
        methodsThatShouldExist_jdk8.put("getErrorWriter", new Class[] {});
        methodsThatShouldExist_jdk8.put("setErrorWriter", new Class[] {java.io.Writer.class});
        methodsThatShouldExist_jdk8.put("setAttribute", new Class[] {java.lang.String.class, java.lang.Object.class, int.class});
        methodsThatShouldExist_jdk8.put("getAttribute", new Class[] {java.lang.String.class});
        methodsThatShouldExist_jdk8.put("getAttribute", new Class[] {java.lang.String.class, int.class});
        methodsThatShouldExist_jdk8.put("removeAttribute", new Class[] {java.lang.String.class, int.class});
        methodsThatShouldExist_jdk8.put("getAttributesScope", new Class[] {java.lang.String.class});
        methodsThatShouldExist_jdk8.put("getScopes", 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.simpleScriptContextClass.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.SimpleScriptContext.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.simpleScriptContextClass.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.SimpleScriptContext.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.simpleScriptContextClass.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.SimpleScriptContext.getClass().getAnnotation()
     */
    protected void testGetAnnotation() {
        Annotation annotation;
        annotation = this.simpleScriptContextClass.getAnnotation(java.lang.annotation.Annotation.class);
        assertNull(annotation, "annotation java.lang.annotation.Annotation should not be returned");
        annotation = this.simpleScriptContextClass.getAnnotation(java.lang.annotation.Documented.class);
        assertNull(annotation, "annotation java.lang.annotation.Documented should not be returned");
        annotation = this.simpleScriptContextClass.getAnnotation(java.lang.annotation.Inherited.class);
        assertNull(annotation, "annotation java.lang.annotation.Inherited should not be returned");
        annotation = this.simpleScriptContextClass.getAnnotation(java.lang.annotation.Retention.class);
        assertNull(annotation, "annotation java.lang.annotation.Retention should not be returned");
        annotation = this.simpleScriptContextClass.getAnnotation(java.lang.annotation.Target.class);
        assertNull(annotation, "annotation java.lang.annotation.Target should not be returned");
        annotation = this.simpleScriptContextClass.getAnnotation(java.lang.Deprecated.class);
        assertNull(annotation, "annotation java.lang.Deprecated should not be returned");
        annotation = this.simpleScriptContextClass.getAnnotation(java.lang.Override.class);
        assertNull(annotation, "annotation java.lang.Override should not be returned");
        annotation = this.simpleScriptContextClass.getAnnotation(java.lang.SuppressWarnings.class);
        assertNull(annotation, "annotation java.lang.SuppressWarnings should not be returned");
    }

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

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

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

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

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

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

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

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

    /**
     * Test for method javax.script.SimpleScriptContext.getClass().getGenericInterfaces()
     */
    protected void testGetGenericInterfaces() {
        // array of interface names that should exists
        final String[] genericInterfaceNames_jdk6 = {
            "interface javax.script.ScriptContext",
        };

        final String[] genericInterfaceNames_jdk7 = {
            "interface javax.script.ScriptContext",
        };

        final String[] genericInterfaceNames_jdk8 = {
            "interface javax.script.ScriptContext",
        };

        // 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.simpleScriptContextClass.getGenericInterfaces();
        assertNotNull(genericInterfaces, "getGenericInterfaces() returns null");
        assertEquals(1, 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.SimpleScriptContext.getClass().getEnumConstants()
     */
    protected void testGetEnumConstants() {
        Object[] enumConstants = this.simpleScriptContextClass.getEnumConstants();
        assertNull(enumConstants, "getEnumConstants() does not return null");
    }

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

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

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

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

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

        try {
            this.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.SimpleScriptContext.getClass().cast()
     */
    protected void testCast() {
        try {
            this.simpleScriptContextClass.cast(new javax.script.SimpleScriptContext());
        }
        catch (Exception e) {
            e.printStackTrace();
            throw new AssertionError(e.getMessage());
        }

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

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

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

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

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

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

        try {
            this.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.cast(Integer.valueOf(42));
            throw new AssertionError("Class.cast(Integer.valueOf(42)) does not throw any exception");
        }
        catch (Exception e) {
            // expected exception
        }

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

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

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

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

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

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

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

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

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

        try {
            this.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.simpleScriptContextClass.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.SimpleScriptContext.getClass().newInstance()
     */
    protected void testNewInstance() {
        try {
            Object o = this.simpleScriptContextClass.newInstance();
        }
        catch (InstantiationException e) {
            e.printStackTrace();
            throw new AssertionError(e.getMessage());
        }
        catch (IllegalAccessException e) {
            e.printStackTrace();
            throw new AssertionError(e.getMessage());
        }

    }

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

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

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

    /**
     * Test for method javax.script.SimpleScriptContext.getClass().getResourceAsStreamNPETest()
     */
    protected void testGetResourceAsStreamNPETest() {
        try {
            Object resource = this.simpleScriptContextClass.getResourceAsStream(null);
            throw new AssertionError("NullPointerException expected!");
        }
        catch (NullPointerException e) {
            //This is OK OK
        }
    }

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

    /**
     * Test for method javax.script.SimpleScriptContext.getClass().getResourceAsStreamPositiveTest()
     */
    protected void testGetResourceAsStreamPositiveTest() {
        Object stream;
        stream = this.simpleScriptContextClass.getResourceAsStream("/org/RhinoTests/AbstractScriptEngineClassTest.class");
        assertNotNull(stream, "getResourceAsStream(\"/org/RhinoTests/AbstractScriptEngineClassTest.class\") returns null");
    }

    /**
     * Test for method javax.script.SimpleScriptContext.getClass().toString()
     */
    protected void testToString() {
        String asString;
        asString = this.simpleScriptContextClass.toString();
        assertEquals("class javax.script.SimpleScriptContext", asString, "wrong toString() return value");
    }

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

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

        // check operator instanceof against all superclasses
        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 SimpleScriptContextClassTest().doTests(args);
    }
}