* @author Tom Baeyens
*/
public class _02_ConditionalBranchingTest extends TestCase {
public void testCompositeConditionalBranching() {
ProcessDefinition processDefinition = ProcessFactory.build()
.compositeNode("creditRate?").initial().behaviour(new CompositeCreditRating())
.node("good").behaviour(new WaitState())
.node("average").behaviour(new WaitState())
.node("bad").behaviour(new WaitState())
.compositeEnd()
.done();
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("creditRate", 13);
Execution execution = processDefinition.startExecution(variables);
assertEquals("good", execution.getNode().getName());
variables = new HashMap<String, Object>();
variables.put("creditRate", 2);
execution = processDefinition.startExecution(variables);
assertEquals("average", execution.getNode().getName());
variables = new HashMap<String, Object>();
variables.put("creditRate", -18);
execution = processDefinition.startExecution(variables);
assertEquals("bad", execution.getNode().getName());
}