@@ -34,7 +34,7 @@ class DefaultEventHandlerTest {
34
34
private static final Logger log = LoggerFactory .getLogger (DefaultEventHandlerTest .class );
35
35
36
36
public static final int FAKE_CONTROLLER_EXECUTION_DURATION = 250 ;
37
- public static final int SEPARATE_EXECUTION_TIMEOUT = 450 ;
37
+ public static final int SEPARATE_EXECUTION_TIMEOUT = 150 ;
38
38
private EventDispatcher eventDispatcherMock = mock (EventDispatcher .class );
39
39
private CustomResourceCache customResourceCache = new CustomResourceCache ();
40
40
private DefaultEventSourceManager defaultEventSourceManagerMock =
@@ -174,21 +174,26 @@ public void successfulExecutionResetsTheRetry() {
174
174
PostExecutionControl .exceptionDuringExecution (new RuntimeException ("test" ));
175
175
PostExecutionControl defaultDispatchControl = PostExecutionControl .defaultDispatch ();
176
176
177
- defaultEventHandlerWithRetry .handleEvent (event );
178
- defaultEventHandlerWithRetry .eventProcessingFinished (
179
- executionScope , postExecutionControlWithException );
177
+ when (eventDispatcherMock .handleExecution (any ()))
178
+ .thenReturn (postExecutionControlWithException )
179
+ .thenReturn (defaultDispatchControl );
180
+
181
+ ArgumentCaptor <ExecutionScope > executionScopeArgumentCaptor =
182
+ ArgumentCaptor .forClass (ExecutionScope .class );
180
183
181
184
defaultEventHandlerWithRetry .handleEvent (event );
182
- defaultEventHandlerWithRetry .eventProcessingFinished (executionScope , defaultDispatchControl );
183
185
186
+ verify (eventDispatcherMock , timeout (SEPARATE_EXECUTION_TIMEOUT ).times (1 ))
187
+ .handleExecution (any ());
184
188
defaultEventHandlerWithRetry .handleEvent (event );
185
189
186
- log .info ("Finished successfulExecutionResetsTheRetry" );
190
+ verify (eventDispatcherMock , timeout (SEPARATE_EXECUTION_TIMEOUT ).times (2 ))
191
+ .handleExecution (any ());
192
+ defaultEventHandlerWithRetry .handleEvent (event );
187
193
188
- ArgumentCaptor <ExecutionScope > executionScopeArgumentCaptor =
189
- ArgumentCaptor .forClass (ExecutionScope .class );
190
194
verify (eventDispatcherMock , timeout (SEPARATE_EXECUTION_TIMEOUT ).times (3 ))
191
- .handleExecution (executionScopeArgumentCaptor .capture ());
195
+ .handleExecution (executionScopeArgumentCaptor .capture ());
196
+ log .info ("Finished successfulExecutionResetsTheRetry" );
192
197
193
198
List <ExecutionScope > executionScopes = executionScopeArgumentCaptor .getAllValues ();
194
199
0 commit comments