anotherProcess.setStartState( anotherState1 );
ProcessEngine engine = new ProcessEngine();
ProcessContext context = engine.spawn( this.process );
assertSame( this.process,
context.getCurrentProcess() );
assertSame( this.state,
context.getCurrentState() );
SpawnActivity activity = new SpawnActivity( anotherProcess );
activity.perform( context );
assertSame( this.process,
context.getCurrentProcess() );
assertSame( this.state,
context.getCurrentState() );
engine.start();
Thread.sleep( 1000 );
Set children = context.getChildren();
assertEquals( 1,
children.size() );
ProcessContext child = (ProcessContext) children.iterator().next();
assertSame( anotherProcess,
child.getCurrentProcess() );
assertSame( anotherState1,
child.getCurrentState() );
}