Skip to content

Commit aec6b04

Browse files
committed
Unit tests now using Junit5. The build passes.
1 parent 49e1326 commit aec6b04

File tree

3 files changed

+68
-116
lines changed

3 files changed

+68
-116
lines changed

src/main/java/org/apache/commons/collections4/list/IndexedLinkedList.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1431,7 +1431,7 @@ public void add(int index, E element) {
14311431
} else {
14321432
linkBefore(element,
14331433
index,
1434-
getNode(index));
1434+
fingerList.getNodeNoFingersFix(index));
14351435
}
14361436
}
14371437

src/test/java/org/apache/commons/collections4/list/FingerListTest.java

Lines changed: 8 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,24 @@
1616
*/
1717
package org.apache.commons.collections4.list;
1818

19-
/**
20-
* The test for finger list of a
21-
* {@link org.apache.commons.collections4.list.IndexedLinkedList}.
22-
*/
23-
2419
import org.apache.commons.collections4.list.IndexedLinkedList.Finger;
2520
import org.apache.commons.collections4.list.IndexedLinkedList.FingerList;
2621
import org.apache.commons.collections4.list.IndexedLinkedList.Node;
2722
import java.util.Arrays;
28-
import static org.junit.Assert.assertEquals;
29-
import static org.junit.Assert.assertFalse;
30-
import static org.junit.Assert.assertTrue;
31-
import org.junit.Before;
32-
import org.junit.Test;
23+
import org.junit.jupiter.api.Test;
24+
import org.junit.jupiter.api.BeforeEach;
25+
import static org.junit.jupiter.api.Assertions.*;
3326

27+
/**
28+
* The test for finger list of a
29+
* {@link org.apache.commons.collections4.list.IndexedLinkedList}.
30+
*/
3431
public class FingerListTest {
3532

3633
private final IndexedLinkedList<Integer> list = new IndexedLinkedList<>();
3734
private final FingerList<Integer> fl = list.fingerList;
3835

39-
@Before
36+
@BeforeEach
4037
public void setUp() {
4138
fl.clear();
4239
}
@@ -199,8 +196,6 @@ public void makeRoomAtPrefix1Old() {
199196
assertEquals(3, finger0.index);
200197
assertEquals(4, finger1.index);
201198
assertEquals(5, finger2.index);
202-
203-
//System.out.println("makeRoomAtPrefix1Oldl passed!");
204199
}
205200

206201
@Test
@@ -215,8 +210,6 @@ public void makeRoomAtPrefix1() {
215210
expectedList.fingerList.setFingerIndices(0, 1, 4, 6);
216211

217212
assertTrue(list.strongEquals(expectedList));
218-
219-
//System.out.println("makeRoomAtPrefix1 passed!");
220213
}
221214

222215
@Test
@@ -231,8 +224,6 @@ public void makeRoomAtPrefix2() {
231224
expectedList.fingerList.setFingerIndices(1, 2, 5, 8);
232225

233226
assertTrue(list.strongEquals(expectedList));
234-
235-
//System.out.println("makeRoomAtPrefix2 passed!");
236227
}
237228

238229
@Test
@@ -247,8 +238,6 @@ public void makeRoomAtPrefix3() {
247238
expectedList.fingerList.setFingerIndices(1, 2, 6, 9);
248239

249240
assertTrue(list.strongEquals(expectedList));
250-
251-
//System.out.println("makeRoomAtPrefix3 passed!");
252241
}
253242

254243
@Test
@@ -263,8 +252,6 @@ public void makeRoomAtPrefix4() {
263252
expectedList.fingerList.setFingerIndices(0, 1, 7, 8);
264253

265254
assertTrue(list.strongEquals(expectedList));
266-
267-
//System.out.println("makeRoomAtPrefix4 passed!");
268255
}
269256

270257
@Test
@@ -279,8 +266,6 @@ public void makeRoomAtPrefix5() {
279266
expectedList.fingerList.setFingerIndices(0, 2, 6, 8);
280267

281268
assertTrue(list.strongEquals(expectedList));
282-
283-
//System.out.println("makeRoomAtPrefix5 passed!");
284269
}
285270

286271
@Test
@@ -300,8 +285,6 @@ public void makeRoomAtPrefix6() {
300285
);
301286

302287
assertTrue(list.strongEquals(expectedList));
303-
304-
//System.out.println("makeRoomAtPrefix6 passed!");
305288
}
306289

307290
@Test
@@ -315,8 +298,6 @@ public void makeRoomAtSuffix1() {
315298
expectedList.fingerList.setFingerIndices(3, 4, 8, 9);
316299

317300
assertTrue(list.strongEquals(expectedList));
318-
319-
//System.out.println("makeRoomAtSuffix1 passed!");
320301
}
321302

322303
@Test
@@ -330,8 +311,6 @@ public void makeRoomAtSuffix2() {
330311
expectedList.fingerList.setFingerIndices(3, 4, 8, 9);
331312

332313
assertTrue(list.strongEquals(expectedList));
333-
334-
//System.out.println("makeRoomAtSuffix2 passed!");
335314
}
336315

337316
@Test
@@ -345,8 +324,6 @@ public void makeRoomAtSuffix3() {
345324
expectedList.fingerList.setFingerIndices(3, 4, 8, 9);
346325

347326
assertTrue(list.strongEquals(expectedList));
348-
349-
//System.out.println("makeRoomAtSuffix3 passed!");
350327
}
351328

352329
@Test
@@ -360,8 +337,6 @@ public void makeRoomAtSuffix4() {
360337
expectedList.fingerList.setFingerIndices(3, 4, 7, 8);
361338

362339
assertTrue(list.strongEquals(expectedList));
363-
364-
//System.out.println("makeRoomAtSuffix4 passed!");
365340
}
366341

367342
@Test
@@ -375,8 +350,6 @@ public void arrangePrefix1() {
375350
expectedList.fingerList.setFingerIndices(0, 1, 2, 3);
376351

377352
assertTrue(list.strongEquals(expectedList));
378-
379-
//System.out.println("arrangePrefix1 passed!");
380353
}
381354

382355
@Test
@@ -390,8 +363,6 @@ public void arrangePrefix2() {
390363
expectedList.fingerList.setFingerIndices(1, 2, 3, 4);
391364

392365
assertTrue(list.strongEquals(expectedList));
393-
394-
//System.out.println("arrangePrefix2 passed!");
395366
}
396367

397368
@Test
@@ -421,8 +392,6 @@ public void arrangePrefix3() {
421392
);
422393

423394
assertTrue(list.strongEquals(expectedList));
424-
425-
//System.out.println("arrangePrefix3 passed!");
426395
}
427396

428397
@Test
@@ -437,8 +406,6 @@ public void pushCoveredFingersToSuffix1() {
437406
expectedList.fingerList.setFingerIndices(1, 6, 7, 8);
438407

439408
assertTrue(list.strongEquals(expectedList));
440-
441-
//System.out.println("pushCoveredFingersToSuffix1 passed!");
442409
}
443410

444411
@Test
@@ -453,8 +420,6 @@ public void pushCoveredFingersToSuffix2() {
453420
expectedList.fingerList.setFingerIndices(4, 5, 6, 9);
454421

455422
assertTrue(list.strongEquals(expectedList));
456-
457-
//System.out.println("pushCoveredFingersToSuffix2 passed!");
458423
}
459424

460425
@Test
@@ -471,8 +436,6 @@ public void arrange1() {
471436
);
472437

473438
assertTrue(list.strongEquals(expectedList));
474-
475-
//System.out.println("arrange1 passed!");
476439
}
477440

478441
@Test
@@ -493,8 +456,6 @@ public void removeFingersOnDeleteRange1() {
493456
expectedFingerList.fingerArray[6] = new Finger<>(new Node<>(null), 80);
494457

495458
assertEquals(expectedFingerList, list.fingerList);
496-
497-
//System.out.println("removeFingersOnDeleteRange1 passed!");
498459
}
499460

500461
@Test

0 commit comments

Comments
 (0)