use of org.springframework.scripting.ScriptEvaluator in project spring-framework by spring-projects.
the class BshScriptEvaluatorTests method testBshScriptFromFile.
@Test
public void testBshScriptFromFile() {
ScriptEvaluator evaluator = new BshScriptEvaluator();
Object result = evaluator.evaluate(new ResourceScriptSource(new ClassPathResource("simple.bsh", getClass())));
assertEquals(6, result);
}
use of org.springframework.scripting.ScriptEvaluator in project spring-framework by spring-projects.
the class BshScriptEvaluatorTests method testGroovyScriptWithArguments.
@Test
public void testGroovyScriptWithArguments() {
ScriptEvaluator evaluator = new BshScriptEvaluator();
Map<String, Object> arguments = new HashMap<>();
arguments.put("a", 3);
arguments.put("b", 2);
Object result = evaluator.evaluate(new StaticScriptSource("return a * b;"), arguments);
assertEquals(6, result);
}
Aggregations