16
16
17
17
import static org .assertj .core .api .Assertions .assertThat ;
18
18
import static org .assertj .core .api .Assertions .assertThatThrownBy ;
19
+ import static org .mockito .Mockito .atLeastOnce ;
19
20
import static org .mockito .Mockito .doThrow ;
20
21
import static org .mockito .Mockito .mock ;
21
- import static org .mockito .Mockito .times ;
22
22
import static org .mockito .Mockito .verify ;
23
23
24
24
import java .util .concurrent .TimeUnit ;
@@ -81,7 +81,7 @@ public void executeThrowsTransactionExceptionIfDoOpFailedWithRuntimeException()
81
81
public void doOpCallsDoBeforeCompletion () {
82
82
beforeCompletion .doOp (txState );
83
83
84
- verify (txState , times ( 1 ) ).doBeforeCompletion ();
84
+ verify (txState ).doBeforeCompletion ();
85
85
}
86
86
87
87
@ Test
@@ -106,17 +106,17 @@ public void executeThrowsIfCancelCriterionThrows() {
106
106
}
107
107
108
108
@ Test
109
- public void executeWaitsUntilDoOpFinish () throws Exception {
109
+ public void executeWaitsUntilDoOpFinish () {
110
110
Thread thread = new Thread (() -> beforeCompletion .execute (cancelCriterion ));
111
111
thread .start ();
112
112
// give the thread a chance to get past the "finished" check by waiting until
113
113
// checkCancelInProgress is called
114
- Awaitility .await ().atMost (60 , TimeUnit .SECONDS )
115
- .untilAsserted (() -> verify (cancelCriterion , times ( 1 )).checkCancelInProgress (null ));
114
+ Awaitility .await ().atMost (5 , TimeUnit .MINUTES )
115
+ .untilAsserted (() -> verify (cancelCriterion , atLeastOnce ( )).checkCancelInProgress (null ));
116
116
117
117
beforeCompletion .doOp (txState );
118
118
119
- Awaitility .await ().atMost (60 , TimeUnit .SECONDS ).until (() -> !(thread .isAlive ()));
119
+ Awaitility .await ().atMost (5 , TimeUnit .MINUTES ).until (() -> !(thread .isAlive ()));
120
120
}
121
121
122
122
}
0 commit comments