1818package org .apache .bookkeeper .client ;
1919
2020import static org .apache .bookkeeper .common .concurrent .FutureUtils .result ;
21- import static org .junit .Assert .assertEquals ;
22- import static org .junit .Assert .assertFalse ;
23- import static org .junit .Assert .assertTrue ;
24- import static org .junit .Assert .fail ;
21+ import static org .junit .jupiter .api .Assertions .assertEquals ;
22+ import static org .junit .jupiter .api .Assertions .assertFalse ;
23+ import static org .junit .jupiter .api .Assertions .assertThrows ;
24+ import static org .junit .jupiter .api .Assertions .assertTrue ;
25+ import static org .junit .jupiter .api .Assertions .fail ;
2526
2627import io .netty .buffer .ByteBuf ;
2728import io .netty .buffer .Unpooled ;
3031import org .apache .bookkeeper .client .api .WriteFlag ;
3132import org .apache .bookkeeper .client .api .WriteHandle ;
3233import org .apache .bookkeeper .net .BookieId ;
33- import org .junit .Test ;
34+ import org .junit .jupiter . api . Test ;
3435
3536/**
3637 * Client side tests on deferred sync write flag.
@@ -42,7 +43,7 @@ public class DeferredSyncTest extends MockBookKeeperTestCase {
4243 static final int NUM_ENTRIES = 100 ;
4344
4445 @ Test
45- public void testAddEntryLastAddConfirmedDoesNotAdvance () throws Exception {
46+ void addEntryLastAddConfirmedDoesNotAdvance () throws Exception {
4647 try (WriteHandle wh = result (newCreateLedgerOp ()
4748 .withEnsembleSize (3 )
4849 .withWriteQuorumSize (3 )
@@ -61,7 +62,7 @@ public void testAddEntryLastAddConfirmedDoesNotAdvance() throws Exception {
6162 }
6263
6364 @ Test
64- public void testAddEntryLastAddConfirmedAdvanceWithForce () throws Exception {
65+ void addEntryLastAddConfirmedAdvanceWithForce () throws Exception {
6566 try (WriteHandle wh = result (newCreateLedgerOp ()
6667 .withEnsembleSize (3 )
6768 .withWriteQuorumSize (3 )
@@ -82,7 +83,7 @@ public void testAddEntryLastAddConfirmedAdvanceWithForce() throws Exception {
8283 }
8384
8485 @ Test
85- public void testForceOnWriteAdvHandle () throws Exception {
86+ void forceOnWriteAdvHandle () throws Exception {
8687 try (WriteAdvHandle wh = result (newCreateLedgerOp ()
8788 .withEnsembleSize (3 )
8889 .withWriteQuorumSize (3 )
@@ -112,7 +113,7 @@ public void testForceOnWriteAdvHandle() throws Exception {
112113 }
113114
114115 @ Test
115- public void testForceRequiresFullEnsemble () throws Exception {
116+ void forceRequiresFullEnsemble () throws Exception {
116117 try (WriteHandle wh = result (newCreateLedgerOp ()
117118 .withEnsembleSize (3 )
118119 .withWriteQuorumSize (2 )
@@ -146,7 +147,7 @@ public void testForceRequiresFullEnsemble() throws Exception {
146147 }
147148
148149 @ Test
149- public void testForceWillAdvanceLacOnlyUpToLastAcknowledgedWrite () throws Exception {
150+ void forceWillAdvanceLacOnlyUpToLastAcknowledgedWrite () throws Exception {
150151 try (WriteHandle wh = result (newCreateLedgerOp ()
151152 .withEnsembleSize (3 )
152153 .withWriteQuorumSize (3 )
@@ -187,7 +188,7 @@ public void testForceWillAdvanceLacOnlyUpToLastAcknowledgedWrite() throws Except
187188 }
188189
189190 @ Test
190- public void testForbiddenEnsembleChange () throws Exception {
191+ void forbiddenEnsembleChange () throws Exception {
191192 try (WriteHandle wh = result (newCreateLedgerOp ()
192193 .withEnsembleSize (1 )
193194 .withWriteQuorumSize (1 )
@@ -218,8 +219,8 @@ public void testForbiddenEnsembleChange() throws Exception {
218219 }
219220 }
220221
221- @ Test ( expected = BKException . BKLedgerClosedException . class )
222- public void testCannotIssueForceOnClosedLedgerHandle () throws Exception {
222+ @ Test
223+ void cannotIssueForceOnClosedLedgerHandle () throws Exception {
223224 WriteHandle wh = result (newCreateLedgerOp ()
224225 .withEnsembleSize (1 )
225226 .withWriteQuorumSize (1 )
@@ -228,7 +229,8 @@ public void testCannotIssueForceOnClosedLedgerHandle() throws Exception {
228229 .withWriteFlags (WriteFlag .DEFERRED_SYNC )
229230 .execute ());
230231 wh .close ();
231- result (wh .force ());
232+ assertThrows (BKException .BKLedgerClosedException .class , () ->
233+ result (wh .force ()));
232234 }
233235
234236}
0 commit comments