use of com.enonic.xp.script.ScriptExports in project xp by enonic.
the class ScriptMapGeneratorTest method testObject.
@Test
public void testObject() {
final Object obj = (MapSerializable) gen -> {
gen.value("a", 1);
gen.value("b", "2");
gen.value("c", 3L);
gen.value("d", 4.0f);
};
final ScriptExports exports = runTestScript("serializer/serializer-test.js");
exports.executeMethod("testObject", obj);
}
use of com.enonic.xp.script.ScriptExports in project xp by enonic.
the class ScriptTestSupport method runFunction.
protected final ScriptValue runFunction(final String path, final String funcName, final Object... funcParams) {
final ScriptExports exports = runScript(path);
assertNotNull(exports, "No exports in [" + path + "]");
assertTrue(exports.hasMethod(funcName), "No functions exported named [" + funcName + "] in [" + path + "]");
return exports.executeMethod(funcName, funcParams);
}
Aggregations