private Flow createFlowWithSubflow(final String parentId, final String childId) {
// Create a flow containing a subflow followed by a view state
final Flow parent = new Flow(parentId);
final Flow child = createSimpleFlow(childId);
final ActionState state1 = new ActionState(parent, "state1-action");
final SubflowState state2 = new SubflowState(parent, "state2-subflow", new StaticExpression(child));
final ViewState state3 = new ViewState(parent, "state3-view", new MockViewFactory("parentview"));
new EndState(parent, "state4-end");
state1.getActionList().add(new MockAction("state1-result"));
state1.getTransitionSet().add(new Transition(new DefaultTargetStateResolver("state2-subflow")));
state2.getTransitionSet().add(new Transition(new DefaultTargetStateResolver("state3-view")));
state3.getTransitionSet().add(new Transition(new DefaultTargetStateResolver("state4-end")));
return parent;
}