public void testDefault() { Token token = new Token(); ExecutionContext executionContext = new ExecutionContext(token); try { JbpmExpressionEvaluator.evaluate("${sum(2, 3)}", executionContext); fail("expected exception"); } catch (JbpmException e) { // OK } }
public void testTestMapper() { JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseXmlString( "<jbpm-configuration>" + " <bean name='jbpm.function.mapper' class='" + TestFunctionMapper.class.getName() + "' />" + "</jbpm-configuration>"); JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext(); try { Token token = new Token(); ExecutionContext executionContext = new ExecutionContext(token); Object result = JbpmExpressionEvaluator.evaluate("${sum(2, 3)}", executionContext); assertEquals(new Integer(5), result); } finally { jbpmContext.close(); } }