17
17
18
18
package org .apache .arrow .vector ;
19
19
20
- import static org .junit .Assert .assertEquals ;
21
- import static org .junit .Assert .assertFalse ;
22
- import static org .junit .Assert .assertSame ;
23
- import static org .junit .Assert .assertTrue ;
20
+ import static org .junit .jupiter . api . Assertions .assertEquals ;
21
+ import static org .junit .jupiter . api . Assertions .assertFalse ;
22
+ import static org .junit .jupiter . api . Assertions .assertSame ;
23
+ import static org .junit .jupiter . api . Assertions .assertTrue ;
24
24
25
25
import java .util .stream .IntStream ;
26
26
29
29
import org .apache .arrow .memory .util .hash .MurmurHasher ;
30
30
import org .apache .arrow .vector .testing .ValueVectorDataPopulator ;
31
31
import org .apache .arrow .vector .util .TransferPair ;
32
- import org .junit .After ;
33
- import org .junit .Assert ;
34
- import org .junit .Before ;
35
- import org .junit .Test ;
32
+ import org .junit .jupiter .api .AfterEach ;
33
+ import org .junit .jupiter .api .BeforeEach ;
34
+ import org .junit .jupiter .api .Test ;
36
35
37
36
public class TestBitVector {
38
37
private static final String EMPTY_SCHEMA_PATH = "" ;
39
38
40
39
private BufferAllocator allocator ;
41
40
42
- @ Before
41
+ @ BeforeEach
43
42
public void init () {
44
43
allocator = new RootAllocator (Long .MAX_VALUE );
45
44
}
46
45
47
- @ After
46
+ @ AfterEach
48
47
public void terminate () throws Exception {
49
48
allocator .close ();
50
49
}
@@ -124,8 +123,8 @@ public void testSplitAndTransfer() throws Exception {
124
123
for (int i = 0 ; i < length ; i ++) {
125
124
int actual = toVector .get (i );
126
125
int expected = sourceVector .get (start + i );
127
- assertEquals ("different data values not expected --> sourceVector index: " + ( start + i ) +
128
- " toVector index: " + i , expected , actual );
126
+ assertEquals (expected , actual ,
127
+ "different data values not expected --> sourceVector index: " + ( start + i ) + " toVector index: " + i );
129
128
}
130
129
}
131
130
}
@@ -167,8 +166,8 @@ public void testSplitAndTransfer1() throws Exception {
167
166
for (int i = 0 ; i < length ; i ++) {
168
167
int actual = toVector .get (i );
169
168
int expected = sourceVector .get (start + i );
170
- assertEquals ("different data values not expected --> sourceVector index: " + ( start + i ) +
171
- " toVector index: " + i , expected , actual );
169
+ assertEquals (expected , actual ,
170
+ "different data values not expected --> sourceVector index: " + ( start + i ) + " toVector index: " + i );
172
171
}
173
172
}
174
173
}
@@ -218,8 +217,8 @@ public void testSplitAndTransfer2() throws Exception {
218
217
for (int i = 0 ; i < length ; i ++) {
219
218
int actual = toVector .get (i );
220
219
int expected = sourceVector .get (start + i );
221
- assertEquals ("different data values not expected --> sourceVector index: " + ( start + i ) +
222
- " toVector index: " + i , expected , actual );
220
+ assertEquals (expected , actual ,
221
+ "different data values not expected --> sourceVector index: " + ( start + i ) + " toVector index: " + i );
223
222
}
224
223
}
225
224
}
@@ -241,9 +240,9 @@ public void testReallocAfterVectorTransfer1() {
241
240
242
241
for (int i = 0 ; i < valueCapacity ; i ++) {
243
242
if ((i & 1 ) == 1 ) {
244
- assertEquals ("unexpected cleared bit at index: " + i , 1 , vector . get ( i ) );
243
+ assertEquals (1 , vector . get ( i ), "unexpected cleared bit at index: " + i );
245
244
} else {
246
- assertTrue ("unexpected set bit at index: " + i , vector . isNull ( i ) );
245
+ assertTrue (vector . isNull ( i ), "unexpected set bit at index: " + i );
247
246
}
248
247
}
249
248
@@ -259,9 +258,9 @@ public void testReallocAfterVectorTransfer1() {
259
258
260
259
for (int i = 0 ; i < valueCapacity * 2 ; i ++) {
261
260
if (((i & 1 ) == 1 ) || (i == valueCapacity )) {
262
- assertEquals ("unexpected cleared bit at index: " + i , 1 , vector . get ( i ) );
261
+ assertEquals (1 , vector . get ( i ), "unexpected cleared bit at index: " + i );
263
262
} else {
264
- assertTrue ("unexpected set bit at index: " + i , vector . isNull ( i ) );
263
+ assertTrue (vector . isNull ( i ), "unexpected set bit at index: " + i );
265
264
}
266
265
}
267
266
@@ -277,9 +276,9 @@ public void testReallocAfterVectorTransfer1() {
277
276
278
277
for (int i = 0 ; i < valueCapacity * 4 ; i ++) {
279
278
if (((i & 1 ) == 1 ) || (i == valueCapacity ) || (i == valueCapacity * 2 )) {
280
- assertEquals ("unexpected cleared bit at index: " + i , 1 , vector . get ( i ) );
279
+ assertEquals (1 , vector . get ( i ), "unexpected cleared bit at index: " + i );
281
280
} else {
282
- assertTrue ("unexpected set bit at index: " + i , vector . isNull ( i ) );
281
+ assertTrue (vector . isNull ( i ), "unexpected set bit at index: " + i );
283
282
}
284
283
}
285
284
@@ -297,12 +296,12 @@ public void testReallocAfterVectorTransfer1() {
297
296
if (i <= valueCapacity * 4 ) {
298
297
if (((i & 1 ) == 1 ) || (i == valueCapacity ) ||
299
298
(i == valueCapacity * 2 ) || (i == valueCapacity * 4 )) {
300
- assertEquals ("unexpected cleared bit at index: " + i , 1 , toVector . get ( i ) );
299
+ assertEquals (1 , toVector . get ( i ), "unexpected cleared bit at index: " + i );
301
300
} else {
302
- assertTrue ("unexpected set bit at index: " + i , toVector . isNull ( i ) );
301
+ assertTrue (toVector . isNull ( i ), "unexpected set bit at index: " + i );
303
302
}
304
303
} else {
305
- assertTrue ("unexpected set bit at index: " + i , toVector . isNull ( i ) );
304
+ assertTrue (toVector . isNull ( i ), "unexpected set bit at index: " + i );
306
305
}
307
306
}
308
307
@@ -325,9 +324,9 @@ public void testReallocAfterVectorTransfer2() {
325
324
326
325
for (int i = 0 ; i < valueCapacity ; i ++) {
327
326
if ((i & 1 ) == 1 ) {
328
- assertFalse ("unexpected cleared bit at index: " + i , vector . isNull ( i ) );
327
+ assertFalse (vector . isNull ( i ), "unexpected cleared bit at index: " + i );
329
328
} else {
330
- assertTrue ("unexpected set bit at index: " + i , vector . isNull ( i ) );
329
+ assertTrue (vector . isNull ( i ), "unexpected set bit at index: " + i );
331
330
}
332
331
}
333
332
@@ -343,9 +342,9 @@ public void testReallocAfterVectorTransfer2() {
343
342
344
343
for (int i = 0 ; i < valueCapacity * 2 ; i ++) {
345
344
if (((i & 1 ) == 1 ) || (i == valueCapacity )) {
346
- assertFalse ("unexpected cleared bit at index: " + i , vector . isNull ( i ) );
345
+ assertFalse (vector . isNull ( i ), "unexpected cleared bit at index: " + i );
347
346
} else {
348
- assertTrue ("unexpected set bit at index: " + i , vector . isNull ( i ) );
347
+ assertTrue (vector . isNull ( i ), "unexpected set bit at index: " + i );
349
348
}
350
349
}
351
350
@@ -361,9 +360,9 @@ public void testReallocAfterVectorTransfer2() {
361
360
362
361
for (int i = 0 ; i < valueCapacity * 4 ; i ++) {
363
362
if (((i & 1 ) == 1 ) || (i == valueCapacity ) || (i == valueCapacity * 2 )) {
364
- assertFalse ("unexpected cleared bit at index: " + i , vector . isNull ( i ) );
363
+ assertFalse (vector . isNull ( i ), "unexpected cleared bit at index: " + i );
365
364
} else {
366
- assertTrue ("unexpected set bit at index: " + i , vector . isNull ( i ) );
365
+ assertTrue (vector . isNull ( i ), "unexpected set bit at index: " + i );
367
366
}
368
367
}
369
368
@@ -381,12 +380,12 @@ public void testReallocAfterVectorTransfer2() {
381
380
if (i <= valueCapacity * 4 ) {
382
381
if (((i & 1 ) == 1 ) || (i == valueCapacity ) ||
383
382
(i == valueCapacity * 2 ) || (i == valueCapacity * 4 )) {
384
- assertFalse ("unexpected cleared bit at index: " + i , toVector . isNull ( i ) );
383
+ assertFalse (toVector . isNull ( i ), "unexpected cleared bit at index: " + i );
385
384
} else {
386
- assertTrue ("unexpected set bit at index: " + i , toVector . isNull ( i ) );
385
+ assertTrue (toVector . isNull ( i ), "unexpected set bit at index: " + i );
387
386
}
388
387
} else {
389
- assertTrue ("unexpected set bit at index: " + i , toVector . isNull ( i ) );
388
+ assertTrue (toVector . isNull ( i ), "unexpected set bit at index: " + i );
390
389
}
391
390
}
392
391
@@ -500,13 +499,13 @@ private void validateRange(int length, int start, int count) {
500
499
bitVector .allocateNew (length );
501
500
bitVector .setRangeToOne (start , count );
502
501
for (int i = 0 ; i < start ; i ++) {
503
- Assert . assertTrue (desc + i , bitVector .isNull (i ));
502
+ assertTrue (bitVector .isNull (i ), desc + i );
504
503
}
505
504
for (int i = start ; i < start + count ; i ++) {
506
- Assert . assertEquals (desc + i , 1 , bitVector .get (i ));
505
+ assertEquals (1 , bitVector .get (i ), desc + i );
507
506
}
508
507
for (int i = start + count ; i < length ; i ++) {
509
- Assert . assertTrue (desc + i , bitVector .isNull (i ));
508
+ assertTrue (bitVector .isNull (i ), desc + i );
510
509
}
511
510
}
512
511
}
0 commit comments