@Test
    public void shouldTypeCheck() throws Exception {
        // with no type checking this should pass
        GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine();
        assertEquals(255, scriptEngine.eval("((Object) new java.awt.Color(255, 255, 255)).getRed()"));

        final TypeCheckedGroovyCustomizer provider = new TypeCheckedGroovyCustomizer();
        scriptEngine = new GremlinGroovyScriptEngine(provider);
        try {
            scriptEngine.eval("((Object) new java.awt.Color(255, 255, 255)).getRed()");
            fail("Should have failed type checking");
        } catch (ScriptException se) {
            final Throwable root = ExceptionUtils.getRootCause(se);
            assertEquals(MultipleCompilationErrorsException.class, root.getClass());
            assertThat(se.getMessage(), containsString("[Static type checking] - Cannot find matching method java.lang.Object#getRed(). Please check if the declared type is correct and if the method exists."));
        }
    }
@author Stephen Mallette (http://stephen.genoprime.com)
gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTypeCheckedTest.java