if startingAt beforeHandler must not be called
This commit is contained in:
parent
8ab3306142
commit
99babc5b5a
@ -252,7 +252,6 @@ public class Fsm<T extends Fsm, E> {
|
|||||||
throw new NotInitializedException(format("Unable to find state '%s'", name), e);
|
throw new NotInitializedException(format("Unable to find state '%s'", name), e);
|
||||||
}
|
}
|
||||||
this.done = currentState.isFinish();
|
this.done = currentState.isFinish();
|
||||||
this.currentState.beforeEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void switchToNextState(E event) {
|
private void switchToNextState(E event) {
|
||||||
|
@ -149,7 +149,7 @@ public class FsmTest {
|
|||||||
.withAfterHandler(fsm -> initAfter.set(true))
|
.withAfterHandler(fsm -> initAfter.set(true))
|
||||||
.withProcessor((fsm, event) -> initProcess.set(true))
|
.withProcessor((fsm, event) -> initProcess.set(true))
|
||||||
.end()
|
.end()
|
||||||
.state("intermediate-1")
|
.state("intermediate")
|
||||||
.withBeforeHandler(fsm -> intermediateBefore.set(true))
|
.withBeforeHandler(fsm -> intermediateBefore.set(true))
|
||||||
.withAfterHandler(fsm -> intermediateAfter.set(true))
|
.withAfterHandler(fsm -> intermediateAfter.set(true))
|
||||||
.withProcessor((fsm, event) -> intermediateProcess.set(true))
|
.withProcessor((fsm, event) -> intermediateProcess.set(true))
|
||||||
@ -161,11 +161,11 @@ public class FsmTest {
|
|||||||
.end()
|
.end()
|
||||||
.withTransition()
|
.withTransition()
|
||||||
.from("init")
|
.from("init")
|
||||||
.to("intermediate-1")
|
.to("intermediate")
|
||||||
.checking((fsm, event) -> true)
|
.checking((fsm, event) -> true)
|
||||||
.end()
|
.end()
|
||||||
.withTransition()
|
.withTransition()
|
||||||
.from("intermediate-1")
|
.from("intermediate")
|
||||||
.to("finish")
|
.to("finish")
|
||||||
.checking((fsm, event) -> true)
|
.checking((fsm, event) -> true)
|
||||||
.end()
|
.end()
|
||||||
@ -180,7 +180,7 @@ public class FsmTest {
|
|||||||
Assert.assertFalse(initBefore.get());
|
Assert.assertFalse(initBefore.get());
|
||||||
Assert.assertFalse(initProcess.get());
|
Assert.assertFalse(initProcess.get());
|
||||||
Assert.assertFalse(initAfter.get());
|
Assert.assertFalse(initAfter.get());
|
||||||
Assert.assertTrue(intermediateBefore.get());
|
Assert.assertFalse(intermediateBefore.get());
|
||||||
Assert.assertTrue(intermediateAfter.get());
|
Assert.assertTrue(intermediateAfter.get());
|
||||||
Assert.assertTrue(intermediateProcess.get());
|
Assert.assertTrue(intermediateProcess.get());
|
||||||
Assert.assertTrue(finishBefore.get());
|
Assert.assertTrue(finishBefore.get());
|
||||||
|
Loading…
Reference in New Issue
Block a user