State exists in regions

- Related to work done in #221 where we got
  into trouble for properly exiting states when
  fork/join is used.
This commit is contained in:
Janne Valkealahti
2016-05-08 08:58:50 +01:00
parent 2eb8788ce3
commit 66295d9ed2
2 changed files with 54 additions and 1 deletions

View File

@@ -84,8 +84,41 @@ public class ForkJoinEntryExitTests extends AbstractBuildTests {
.expectStates("S2", "S210", "S220").and()
.step()
.sendEvent("E2")
.expectStateEntered(1)
.expectStateExited(1)
.expectStates("S2", "S211", "S220").and()
.step()
.sendEvent("E3")
.expectStateEntered(3)
.expectStateEntered(2)
.expectStateExited(4)
.expectStates("S3").and()
.build();
plan.test();
}
@Test
@SuppressWarnings("unchecked")
public void testJoinExitsViaChoices() throws Exception {
context.register(Config2.class);
context.refresh();
StateMachine<String, String> stateMachine = context.getBean(StateMachine.class);
StateMachineTestPlan<String, String> plan =
StateMachineTestPlanBuilder.<String, String>builder()
.stateMachine(stateMachine)
.step().expectState("S1").and()
.step()
.sendEvent("E1")
.expectStates("S2", "S210", "S220").and()
.step()
.sendEvent("E2")
.expectStateEntered(1)
.expectStateExited(1)
.expectStates("S2", "S211", "S220").and()
.step()
.sendEvent("E3")
.expectStateEntered(2)
.expectStateExited(4)
.expectStates("S3").and()
.build();
plan.test();