use of org.xwiki.rendering.macro.script.ScriptMockSetup in project xwiki-platform by xwiki.
the class CacheMacroTest method registerComponents.
@Override
protected void registerComponents() throws Exception {
super.registerComponents();
this.mockSetup = new ScriptMockSetup(getMockery(), getComponentManager());
this.cacheMacro = getComponentManager().getInstance(Macro.class, "cache");
this.rendererFactory = getComponentManager().getInstance(PrintRendererFactory.class, "event/1.0");
}
use of org.xwiki.rendering.macro.script.ScriptMockSetup in project xwiki-platform by xwiki.
the class IntegrationTests method initialize.
@RenderingTestSuite.Initialized
public void initialize(MockingComponentManager componentManager) throws Exception {
Mockery mockery = new JUnit4Mockery();
new ScriptMockSetup(mockery, componentManager);
// Script Context Mock
final ScriptContextManager scm = componentManager.registerMockComponent(mockery, ScriptContextManager.class);
final SimpleScriptContext scriptContext = new SimpleScriptContext();
scriptContext.setAttribute("var", "value", ScriptContext.ENGINE_SCOPE);
scriptContext.setAttribute("services", componentManager.getInstance(ScriptServiceManager.class), ScriptContext.ENGINE_SCOPE);
mockery.checking(new Expectations() {
{
allowing(scm).getScriptContext();
will(returnValue(scriptContext));
}
});
}
Aggregations