public void testCreate() throws Exception {
States states = new States();
StateMachine sm = StateMachineFactory.getInstance(Transition.class).create(States.A, states);
State a = sm.getState(States.A);
State b = sm.getState(States.B);
State c = sm.getState(States.C);
State d = sm.getState(States.D);
assertEquals(States.A, a.getId());
assertNull(a.getParent());
assertEquals(States.B, b.getId());
assertSame(a, b.getParent());
assertEquals(States.C, c.getId());
assertSame(b, c.getParent());
assertEquals(States.D, d.getId());
assertSame(a, d.getParent());
List<org.apache.mina.statemachine.transition.Transition> trans = null;
trans = a.getTransitions();
assertEquals(3, trans.size());
assertEquals(new MethodTransition("bar", barInA, states), trans.get(0));
assertEquals(new MethodTransition("*", error, states), trans.get(1));
assertEquals(new MethodTransition("foo", b, fooInA, states), trans.get(2));
trans = b.getTransitions();
assertEquals(1, trans.size());
assertEquals(new MethodTransition("foo", c, fooInB, states), trans.get(0));
trans = c.getTransitions();
assertEquals(3, trans.size());
assertEquals(new MethodTransition("bar", a, barInC, states), trans.get(0));
assertEquals(new MethodTransition("foo", d, fooOrBarInCOrFooInD, states), trans.get(1));
assertEquals(new MethodTransition("bar", d, fooOrBarInCOrFooInD, states), trans.get(2));
trans = d.getTransitions();
assertEquals(1, trans.size());
assertEquals(new MethodTransition("foo", fooOrBarInCOrFooInD, states), trans.get(0));
}