@@ -77,7 +77,7 @@ public void testResetSubStates1() throws Exception {
77
77
ExtendedState extendedState = new DefaultExtendedState (variables );
78
78
DefaultStateMachineContext <States ,Events > stateMachineContext = new DefaultStateMachineContext <States , Events >(States .S12 , Events .I , null , extendedState );
79
79
80
- machine .getStateMachineAccessor ().doWithAllRegions (function -> function .resetStateMachine (stateMachineContext ));
80
+ machine .getStateMachineAccessor ().doWithAllRegions (function -> function .resetStateMachineReactively (stateMachineContext ). block ( ));
81
81
82
82
doStartAndAssert (machine );
83
83
assertThat (machine .getState ().getIds ()).containsOnly (States .S0 , States .S1 , States .S12 );
@@ -95,7 +95,7 @@ public void testResetSubStates2() throws Exception {
95
95
ExtendedState extendedState = new DefaultExtendedState (variables );
96
96
DefaultStateMachineContext <States ,Events > stateMachineContext = new DefaultStateMachineContext <States , Events >(States .S211 , Events .C , null , extendedState );
97
97
98
- machine .getStateMachineAccessor ().doWithAllRegions (function -> function .resetStateMachine (stateMachineContext ));
98
+ machine .getStateMachineAccessor ().doWithAllRegions (function -> function .resetStateMachineReactively (stateMachineContext ). block ( ));
99
99
100
100
doStartAndAssert (machine );
101
101
assertThat (machine .getState ().getIds ()).containsOnly (States .S0 , States .S2 , States .S21 , States .S211 );
@@ -113,7 +113,7 @@ public void testResetSubStates3() throws Exception {
113
113
ExtendedState extendedState = new DefaultExtendedState (variables );
114
114
DefaultStateMachineContext <States ,Events > stateMachineContext = new DefaultStateMachineContext <States , Events >(States .S2 , Events .C , null , extendedState );
115
115
116
- machine .getStateMachineAccessor ().doWithAllRegions (function -> function .resetStateMachine (stateMachineContext ));
116
+ machine .getStateMachineAccessor ().doWithAllRegions (function -> function .resetStateMachineReactively (stateMachineContext ). block ( ));
117
117
118
118
doStartAndAssert (machine );
119
119
assertThat (machine .getState ().getIds ()).containsOnly (States .S0 , States .S2 , States .S21 , States .S211 );
@@ -138,7 +138,7 @@ public void testResetRegions1() {
138
138
DefaultStateMachineContext <TestStates , TestEvents > stateMachineContext =
139
139
new DefaultStateMachineContext <TestStates , TestEvents >(childs , TestStates .S2 , TestEvents .E1 , null , null );
140
140
141
- machine .getStateMachineAccessor ().doWithAllRegions (function -> function .resetStateMachine (stateMachineContext ));
141
+ machine .getStateMachineAccessor ().doWithAllRegions (function -> function .resetStateMachineReactively (stateMachineContext ). block ( ));
142
142
143
143
doStartAndAssert (machine );
144
144
assertThat (machine .getState ().getIds ()).containsOnly (TestStates .S2 , TestStates .S21 , TestStates .S31 );
@@ -162,7 +162,7 @@ public void testResetRegions2() {
162
162
DefaultStateMachineContext <TestStates , TestEvents > stateMachineContext =
163
163
new DefaultStateMachineContext <TestStates , TestEvents >(childs , TestStates .S2 , null , null , null );
164
164
165
- machine .getStateMachineAccessor ().doWithAllRegions (function -> function .resetStateMachine (stateMachineContext ));
165
+ machine .getStateMachineAccessor ().doWithAllRegions (function -> function .resetStateMachineReactively (stateMachineContext ). block ( ));
166
166
167
167
doStartAndAssert (machine );
168
168
assertThat (machine .getState ().getIds ()).containsOnly (TestStates .S2 , TestStates .S21 , TestStates .S31 );
@@ -184,7 +184,7 @@ public void testResetUpdateExtendedStateVariables() {
184
184
ExtendedState extendedState = new DefaultExtendedState (variables );
185
185
DefaultStateMachineContext <States ,Events > stateMachineContext = new DefaultStateMachineContext <States , Events >(States .S0 , null , null , extendedState );
186
186
187
- machine .getStateMachineAccessor ().doWithAllRegions (function -> function .resetStateMachine (stateMachineContext ));
187
+ machine .getStateMachineAccessor ().doWithAllRegions (function -> function .resetStateMachineReactively (stateMachineContext ). block ( ));
188
188
189
189
doStartAndAssert (machine );
190
190
assertThat ((Integer )machine .getExtendedState ().getVariables ().get ("count" )).isEqualTo (1 );
@@ -207,7 +207,7 @@ public void testResetWithNullContext() throws Exception {
207
207
assertThat ((Integer )machine .getExtendedState ().getVariables ().get ("foo" )).isZero ();
208
208
209
209
doStopAndAssert (machine );
210
- machine .getStateMachineAccessor ().doWithAllRegions (function -> function .resetStateMachine (null ));
210
+ machine .getStateMachineAccessor ().doWithAllRegions (function -> function .resetStateMachineReactively (null ). block ( ));
211
211
doStartAndAssert (machine );
212
212
assertThat (machine .getState ().getIds ()).containsOnly (States .S0 , States .S1 , States .S11 );
213
213
assertThat (machine .getExtendedState ().getVariables ()).isEmpty ();
@@ -229,7 +229,7 @@ public void testResetWithEnumToCorrectStartState() throws Exception {
229
229
DefaultStateMachineContext <States , Events > stateMachineContext = new DefaultStateMachineContext <States , Events >(
230
230
States .S11 , null , null , null );
231
231
machine .getStateMachineAccessor ()
232
- .doWithAllRegions (function -> function .resetStateMachine (stateMachineContext ));
232
+ .doWithAllRegions (function -> function .resetStateMachineReactively (stateMachineContext ). block ( ));
233
233
234
234
doStartAndAssert (machine );
235
235
assertThat (machine .getState ().getIds ()).containsOnly (States .S0 , States .S1 , States .S11 );
@@ -246,7 +246,7 @@ public void testRestoreWithTimer() throws Exception {
246
246
247
247
DefaultStateMachineContext <States , Events > stateMachineContext = new DefaultStateMachineContext <States , Events >(States .S1 , null ,
248
248
null , null );
249
- machine .getStateMachineAccessor ().doWithAllRegions (function -> function .resetStateMachine (stateMachineContext ));
249
+ machine .getStateMachineAccessor ().doWithAllRegions (function -> function .resetStateMachineReactively (stateMachineContext ). block ( ));
250
250
251
251
doStartAndAssert (machine );
252
252
Thread .sleep (1100 );
@@ -290,7 +290,7 @@ public void testResetKeepsExtendedStateIntactInSubmachine() {
290
290
ExtendedState extendedState = new DefaultExtendedState (variables );
291
291
DefaultStateMachineContext <States ,Events > stateMachineContext = new DefaultStateMachineContext <States , Events >(States .S0 , null , null , extendedState );
292
292
293
- machine .getStateMachineAccessor ().doWithAllRegions (function -> function .resetStateMachine (stateMachineContext ));
293
+ machine .getStateMachineAccessor ().doWithAllRegions (function -> function .resetStateMachineReactively (stateMachineContext ). block ( ));
294
294
doStartAndAssert (machine );
295
295
296
296
assertThat ((Integer )machine .getExtendedState ().getVariables ().get ("count1" )).isEqualTo (1 );
@@ -321,7 +321,7 @@ public void testResetFunkyEnumTypes1() throws Exception {
321
321
DefaultStateMachineContext <MyState , MyEvent > stateMachineContext = new DefaultStateMachineContext <MyState , MyEvent >(
322
322
SubState .SUB_NEXT , null , null , null );
323
323
324
- machine .getStateMachineAccessor ().doWithAllRegions (function -> function .resetStateMachine (stateMachineContext ));
324
+ machine .getStateMachineAccessor ().doWithAllRegions (function -> function .resetStateMachineReactively (stateMachineContext ). block ( ));
325
325
326
326
doStartAndAssert (machine );
327
327
assertThat (machine .getState ().getIds ()).containsOnly (SuperState .PARENT , SubState .SUB_NEXT );
@@ -337,7 +337,7 @@ public void testResetFunkyEnumTypes2() throws Exception {
337
337
DefaultStateMachineContext <MyState , MyEvent > stateMachineContext = new DefaultStateMachineContext <MyState , MyEvent >(
338
338
SuperState .INITIAL , null , null , null );
339
339
340
- machine .getStateMachineAccessor ().doWithAllRegions (function -> function .resetStateMachine (stateMachineContext ));
340
+ machine .getStateMachineAccessor ().doWithAllRegions (function -> function .resetStateMachineReactively (stateMachineContext ). block ( ));
341
341
342
342
doStartAndAssert (machine );
343
343
assertThat (machine .getState ().getIds ()).containsOnly (SuperState .INITIAL );
0 commit comments