### Question:
JaninoScriptManager extends ScriptManager { public boolean reloadScript(ScriptHook hook) { if ( compiledMap.remove(hook) != null ) { return true; } return false; } protected  JaninoScriptManager(); void compileAllScripts(File scriptDirFile); boolean reloadScript(ScriptHook hook); @Override CompiledClass compileScript(String script,
			File sourceFile); static void main(String args[]);  }### Answer:
@Test public void testReload() throws Exception { GlobalConfig.getInstance().overrideProperty(GlobalConfig.RUNTIME_SCRIPT_DIR, "src/test/config"); File helloFile = new File("src/test/config/script", "Hello.java"); helloFile.getParentFile().mkdirs(); String helloScript = "package script;\n"+ "import java.util.*;\n"+ "\n"+ "import com.xinqihd.sns.gameserver.script.ScriptResult;\n"+ "import com.xinqihd.sns.gameserver.script.ScriptHook;\n"+ "\n"+ "public class Hello {\n"+ "\n"+ " public static ScriptResult func(Object[] context) {\n"+ " List list= new ArrayList(); \n"+ " list.add(\"hello\"); \n"+ " ScriptResult result = new ScriptResult(); \n"+ " result.setType(ScriptResult.Type.SUCCESS_RETURN); \n"+ " result.setResult(list); \n"+ " return result; \n"+ " \n"+ " }\n"+ "}\n"; String worldScript = "package script;\n"+ "import java.util.*;\n"+ "\n"+ "import com.xinqihd.sns.gameserver.script.ScriptResult;\n"+ "\n"+ "public class Hello {\n"+ "\n"+ " public static ScriptResult func(Object[] context) {\n"+ " List list= new ArrayList(); \n"+ " list.add(\"world\"); \n"+ " ScriptResult result = new ScriptResult(); \n"+ " result.setType(ScriptResult.Type.SUCCESS_RETURN); \n"+ " result.setResult(list); \n"+ " return result; \n"+ " \n"+ " }\n"+ "}\n"; FileOutputStream fos = new FileOutputStream(helloFile); fos.write(helloScript.getBytes()); fos.close(); final JaninoScriptManager manager = new JaninoScriptManager(); ScriptResult result1 = manager.runScript(ScriptHook.HELLO, new HashMap()); String str1 = (String)result1.getResult().get(0); fos = new FileOutputStream(helloFile); fos.write(worldScript.getBytes()); fos.close(); manager.reloadScript(ScriptHook.HELLO); ScriptResult result2 = manager.runScript(ScriptHook.HELLO, new HashMap()); String str2 = (String)result2.getResult().get(0); assertEquals("hello", str1); assertEquals("world", str2); }