@Test public void testFetchModuleFromParserWhenModuleExistsReturnsModuleWhichCanBeInvoked() throws Exception { when(model.getRawWikiContent(any(ParsedPageName.class), anyMap())).thenReturn( "return { " + " test_function = function() return 'result' end" + "}"); ScribuntoModule module = subject.fetchModuleFromParser("testModule"); String result = module.invoke("test_function", new Frame(null, null, null, false)); assertThat(result).isEqualTo("result"); }
@Override public ScribuntoModule fetchModuleFromParser(String moduleName) throws ScribuntoException { ParsedPageName pageName = pageNameForModule(moduleName); Prototype prototype = compiledScriptCache.getPrototypeForChunkname(pageName); if (prototype == null) { try (Reader reader = new StringReader(getRawWikiContent(pageName))) { prototype = loadAndCache(reader, pageName); } catch (IOException e) { throw new ScribuntoException(e); } } return new ScribuntoLuaModule(this, prototype, pageName); }
ScribuntoLuaEngine extends ScribuntoEngineBase implements MwInterface { @Override public ScribuntoModule fetchModuleFromParser(String moduleName) throws ScribuntoException { ParsedPageName pageName = pageNameForModule(moduleName); Prototype prototype = compiledScriptCache.getPrototypeForChunkname(pageName); if (prototype == null) { try (Reader reader = new StringReader(getRawWikiContent(pageName))) { prototype = loadAndCache(reader, pageName); } catch (IOException e) { throw new ScribuntoException(e); } } return new ScribuntoLuaModule(this, prototype, pageName); } }
ScribuntoLuaEngine extends ScribuntoEngineBase implements MwInterface { @Override public ScribuntoModule fetchModuleFromParser(String moduleName) throws ScribuntoException { ParsedPageName pageName = pageNameForModule(moduleName); Prototype prototype = compiledScriptCache.getPrototypeForChunkname(pageName); if (prototype == null) { try (Reader reader = new StringReader(getRawWikiContent(pageName))) { prototype = loadAndCache(reader, pageName); } catch (IOException e) { throw new ScribuntoException(e); } } return new ScribuntoLuaModule(this, prototype, pageName); } ScribuntoLuaEngine(IWikiModel model, CompiledScriptCache cache); private  ScribuntoLuaEngine(IWikiModel model, CompiledScriptCache compiledScriptCache, Globals globals); }
ScribuntoLuaEngine extends ScribuntoEngineBase implements MwInterface { @Override public ScribuntoModule fetchModuleFromParser(String moduleName) throws ScribuntoException { ParsedPageName pageName = pageNameForModule(moduleName); Prototype prototype = compiledScriptCache.getPrototypeForChunkname(pageName); if (prototype == null) { try (Reader reader = new StringReader(getRawWikiContent(pageName))) { prototype = loadAndCache(reader, pageName); } catch (IOException e) { throw new ScribuntoException(e); } } return new ScribuntoLuaModule(this, prototype, pageName); } ScribuntoLuaEngine(IWikiModel model, CompiledScriptCache cache); private  ScribuntoLuaEngine(IWikiModel model, CompiledScriptCache compiledScriptCache, Globals globals); @Override ScribuntoModule fetchModuleFromParser(String moduleName); @Override String name(); @Override LuaTable getInterface(); @Override LuaValue getSetupOptions(); }
ScribuntoLuaEngine extends ScribuntoEngineBase implements MwInterface { @Override public ScribuntoModule fetchModuleFromParser(String moduleName) throws ScribuntoException { ParsedPageName pageName = pageNameForModule(moduleName); Prototype prototype = compiledScriptCache.getPrototypeForChunkname(pageName); if (prototype == null) { try (Reader reader = new StringReader(getRawWikiContent(pageName))) { prototype = loadAndCache(reader, pageName); } catch (IOException e) { throw new ScribuntoException(e); } } return new ScribuntoLuaModule(this, prototype, pageName); } ScribuntoLuaEngine(IWikiModel model, CompiledScriptCache cache); private  ScribuntoLuaEngine(IWikiModel model, CompiledScriptCache compiledScriptCache, Globals globals); @Override ScribuntoModule fetchModuleFromParser(String moduleName); @Override String name(); @Override LuaTable getInterface(); @Override LuaValue getSetupOptions();  }