18
18
package org .apache .bookkeeper .client ;
19
19
20
20
import 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 ;
25
26
26
27
import io .netty .buffer .ByteBuf ;
27
28
import io .netty .buffer .Unpooled ;
30
31
import org .apache .bookkeeper .client .api .WriteFlag ;
31
32
import org .apache .bookkeeper .client .api .WriteHandle ;
32
33
import org .apache .bookkeeper .net .BookieId ;
33
- import org .junit .Test ;
34
+ import org .junit .jupiter . api . Test ;
34
35
35
36
/**
36
37
* Client side tests on deferred sync write flag.
@@ -42,7 +43,7 @@ public class DeferredSyncTest extends MockBookKeeperTestCase {
42
43
static final int NUM_ENTRIES = 100 ;
43
44
44
45
@ Test
45
- public void testAddEntryLastAddConfirmedDoesNotAdvance () throws Exception {
46
+ void addEntryLastAddConfirmedDoesNotAdvance () throws Exception {
46
47
try (WriteHandle wh = result (newCreateLedgerOp ()
47
48
.withEnsembleSize (3 )
48
49
.withWriteQuorumSize (3 )
@@ -61,7 +62,7 @@ public void testAddEntryLastAddConfirmedDoesNotAdvance() throws Exception {
61
62
}
62
63
63
64
@ Test
64
- public void testAddEntryLastAddConfirmedAdvanceWithForce () throws Exception {
65
+ void addEntryLastAddConfirmedAdvanceWithForce () throws Exception {
65
66
try (WriteHandle wh = result (newCreateLedgerOp ()
66
67
.withEnsembleSize (3 )
67
68
.withWriteQuorumSize (3 )
@@ -82,7 +83,7 @@ public void testAddEntryLastAddConfirmedAdvanceWithForce() throws Exception {
82
83
}
83
84
84
85
@ Test
85
- public void testForceOnWriteAdvHandle () throws Exception {
86
+ void forceOnWriteAdvHandle () throws Exception {
86
87
try (WriteAdvHandle wh = result (newCreateLedgerOp ()
87
88
.withEnsembleSize (3 )
88
89
.withWriteQuorumSize (3 )
@@ -112,7 +113,7 @@ public void testForceOnWriteAdvHandle() throws Exception {
112
113
}
113
114
114
115
@ Test
115
- public void testForceRequiresFullEnsemble () throws Exception {
116
+ void forceRequiresFullEnsemble () throws Exception {
116
117
try (WriteHandle wh = result (newCreateLedgerOp ()
117
118
.withEnsembleSize (3 )
118
119
.withWriteQuorumSize (2 )
@@ -146,7 +147,7 @@ public void testForceRequiresFullEnsemble() throws Exception {
146
147
}
147
148
148
149
@ Test
149
- public void testForceWillAdvanceLacOnlyUpToLastAcknowledgedWrite () throws Exception {
150
+ void forceWillAdvanceLacOnlyUpToLastAcknowledgedWrite () throws Exception {
150
151
try (WriteHandle wh = result (newCreateLedgerOp ()
151
152
.withEnsembleSize (3 )
152
153
.withWriteQuorumSize (3 )
@@ -187,7 +188,7 @@ public void testForceWillAdvanceLacOnlyUpToLastAcknowledgedWrite() throws Except
187
188
}
188
189
189
190
@ Test
190
- public void testForbiddenEnsembleChange () throws Exception {
191
+ void forbiddenEnsembleChange () throws Exception {
191
192
try (WriteHandle wh = result (newCreateLedgerOp ()
192
193
.withEnsembleSize (1 )
193
194
.withWriteQuorumSize (1 )
@@ -218,8 +219,8 @@ public void testForbiddenEnsembleChange() throws Exception {
218
219
}
219
220
}
220
221
221
- @ Test ( expected = BKException . BKLedgerClosedException . class )
222
- public void testCannotIssueForceOnClosedLedgerHandle () throws Exception {
222
+ @ Test
223
+ void cannotIssueForceOnClosedLedgerHandle () throws Exception {
223
224
WriteHandle wh = result (newCreateLedgerOp ()
224
225
.withEnsembleSize (1 )
225
226
.withWriteQuorumSize (1 )
@@ -228,7 +229,8 @@ public void testCannotIssueForceOnClosedLedgerHandle() throws Exception {
228
229
.withWriteFlags (WriteFlag .DEFERRED_SYNC )
229
230
.execute ());
230
231
wh .close ();
231
- result (wh .force ());
232
+ assertThrows (BKException .BKLedgerClosedException .class , () ->
233
+ result (wh .force ()));
232
234
}
233
235
234
236
}
0 commit comments