Fix substate transition

- Should now correctly do corrent actions when
  transition is between different submachines and
  their substates.
- Fixes #32
This commit is contained in:
Janne Valkealahti
2015-04-04 15:51:45 +01:00
parent a4fcb9da97
commit 8282daf5d8
2 changed files with 30 additions and 3 deletions

View File

@@ -177,6 +177,26 @@ public class ShowcaseTests {
assertThat(listener.statesEntered.size(), is(3));
}
@Test
public void testF() throws Exception {
listener.reset(1, 4, 2, 0);
machine.sendEvent(Events.F);
listener.stateChangedLatch.await(1, TimeUnit.SECONDS);
assertThat(machine.getState().getIds(), contains(States.S0, States.S2, States.S21, States.S211));
assertThat(listener.statesExited.size(), is(2));
assertThat(listener.statesEntered.size(), is(4));
}
@Test
public void testG() throws Exception {
listener.reset(1, 4, 2, 0);
machine.sendEvent(Events.G);
listener.stateChangedLatch.await(1, TimeUnit.SECONDS);
assertThat(machine.getState().getIds(), contains(States.S0, States.S2, States.S21, States.S211));
assertThat(listener.statesExited.size(), is(2));
assertThat(listener.statesEntered.size(), is(4));
}
static class Config {
@Autowired