2828import  org .apache .ratis .statemachine .impl .SimpleStateMachine4Testing ;
2929import  org .apache .ratis .statemachine .StateMachine ;
3030import  org .apache .ratis .statemachine .TransactionContext ;
31- import  org .junit .*;
31+ import  org .junit .jupiter .api .AfterEach ;
32+ import  org .junit .jupiter .api .Assertions ;
33+ import  org .junit .jupiter .api .BeforeEach ;
34+ import  org .junit .jupiter .api .Test ;
3235import  org .mockito .MockedStatic ;
3336import  org .mockito .Mockito ;
3437import  org .slf4j .Logger ;
@@ -121,12 +124,12 @@ public void unblockAllTxns() {
121124    }
122125  }
123126
124-   @ Before 
127+   @ BeforeEach 
125128  public  void  setup () {
126129    mocked  = Mockito .mockStatic (CompletableFuture .class , Mockito .CALLS_REAL_METHODS );
127130  }
128131
129-   @ After 
132+   @ AfterEach 
130133  public  void  tearDownClass () {
131134    if  (mocked  != null ) {
132135      mocked .close ();
@@ -162,10 +165,10 @@ public void testStateMachineShutdownWaitsForApplyTxn() throws Exception {
162165      RaftClientReply  watchReply  = client .io ().watch (
163166              logIndex , RaftProtos .ReplicationLevel .ALL_COMMITTED );
164167      watchReply .getCommitInfos ().forEach (
165-               val  -> Assert .assertTrue (val .getCommitIndex () >= logIndex ));
168+               val  -> Assertions .assertTrue (val .getCommitIndex () >= logIndex ));
166169      final  RaftServer .Division  secondFollower  = cluster .getFollowers ().get (1 );
167170      // Second follower is blocked in apply transaction 
168-       Assert .assertTrue (secondFollower .getInfo ().getLastAppliedIndex () < logIndex );
171+       Assertions .assertTrue (secondFollower .getInfo ().getLastAppliedIndex () < logIndex );
169172
170173      // Now shutdown the follower in a separate thread 
171174      final  Thread  t  = new  Thread (secondFollower ::close );
@@ -176,24 +179,24 @@ public void testStateMachineShutdownWaitsForApplyTxn() throws Exception {
176179      // Now unblock the second follower 
177180      long  minIndex  = ((StateMachineWithConditionalWait ) secondFollower .getStateMachine ()).blockTxns .stream ()
178181              .min (Comparator .naturalOrder ()).get ();
179-       Assert .assertEquals (2 , StateMachineWithConditionalWait .numTxns .values ().stream ()
182+       Assertions .assertEquals (2 , StateMachineWithConditionalWait .numTxns .values ().stream ()
180183                      .filter (val  -> val .get () == 3 ).count ());
181184      // The second follower should still be blocked in apply transaction 
182-       Assert .assertTrue (secondFollower .getInfo ().getLastAppliedIndex () < minIndex );
185+       Assertions .assertTrue (secondFollower .getInfo ().getLastAppliedIndex () < minIndex );
183186      for  (long  index  : ((StateMachineWithConditionalWait ) secondFollower .getStateMachine ()).blockTxns ) {
184187        if  (minIndex  != index ) {
185188          ((StateMachineWithConditionalWait ) secondFollower .getStateMachine ()).unBlockApplyTxn (index );
186189        }
187190      }
188-       Assert .assertEquals (2 , StateMachineWithConditionalWait .numTxns .values ().stream ()
191+       Assertions .assertEquals (2 , StateMachineWithConditionalWait .numTxns .values ().stream ()
189192              .filter (val  -> val .get () == 3 ).count ());
190-       Assert .assertTrue (secondFollower .getInfo ().getLastAppliedIndex () < minIndex );
193+       Assertions .assertTrue (secondFollower .getInfo ().getLastAppliedIndex () < minIndex );
191194      ((StateMachineWithConditionalWait ) secondFollower .getStateMachine ()).unBlockApplyTxn (minIndex );
192195
193196      // Now wait for the thread 
194197      t .join (5000 );
195-       Assert .assertEquals (logIndex , secondFollower .getInfo ().getLastAppliedIndex ());
196-       Assert .assertEquals (3 , StateMachineWithConditionalWait .numTxns .values ().stream ()
198+       Assertions .assertEquals (logIndex , secondFollower .getInfo ().getLastAppliedIndex ());
199+       Assertions .assertEquals (3 , StateMachineWithConditionalWait .numTxns .values ().stream ()
197200              .filter (val  -> val .get () == 3 ).count ());
198201
199202      cluster .shutdown ();
0 commit comments