final ScriptSource scriptSource = scriptSource("def method() { println 'hi' }");
scriptCompilationHandler.compileToDir(scriptSource, classLoader, scriptCacheDir, null, expectedScriptClass);
checkScriptClassesInCache();
Script script = scriptCompilationHandler.loadFromDir(scriptSource, classLoader, scriptCacheDir,
expectedScriptClass).newInstance();
assertThat(script, is(expectedScriptClass));
}