This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git
The following commit(s) were added to refs/heads/master by this push:
new a82fa15 COLLECTIONS-779 - Migrate assert to Assertions (#209)
a82fa15 is described below
commit a82fa15727eb59117635b25d318383021e210092
Author: Arturo Bernal <[email protected]>
AuthorDate: Wed Feb 3 22:40:22 2021 +0100
COLLECTIONS-779 - Migrate assert to Assertions (#209)
---
.../apache/commons/collections4/BagUtilsTest.java | 32 ++----
.../commons/collections4/ClosureUtilsTest.java | 4 +-
.../commons/collections4/CollectionUtilsTest.java | 124 ++++++++++-----------
.../commons/collections4/ComparatorUtilsTest.java | 8 +-
.../commons/collections4/EnumerationUtilsTest.java | 10 +-
.../commons/collections4/FactoryUtilsTest.java | 14 +--
.../commons/collections4/FluentIterableTest.java | 20 ++--
.../commons/collections4/IterableUtilsTest.java | 18 +--
.../commons/collections4/IteratorUtilsTest.java | 80 +++++++------
.../apache/commons/collections4/ListUtilsTest.java | 14 +--
.../commons/collections4/MultiMapUtilsTest.java | 12 +-
.../commons/collections4/MultiSetUtilsTest.java | 10 +-
.../commons/collections4/PredicateUtilsTest.java | 2 +-
.../commons/collections4/QueueUtilsTest.java | 22 ++--
.../apache/commons/collections4/SetUtilsTest.java | 70 ++++++------
.../commons/collections4/SplitMapUtilsTest.java | 16 +--
.../org/apache/commons/collections4/TestUtils.java | 4 +-
.../commons/collections4/TransformerUtilsTest.java | 20 ++--
.../apache/commons/collections4/TrieUtilsTest.java | 9 +-
.../commons/collections4/bag/AbstractBagTest.java | 2 +-
.../bloomfilter/AbstractBloomFilterTest.java | 18 +--
.../bloomfilter/ArrayCountingBloomFilterTest.java | 16 +--
.../bloomfilter/BloomFilterIndexerTest.java | 17 +--
.../bloomfilter/HasherBloomFilterTest.java | 10 +-
.../collections4/bloomfilter/IndexFilterTest.java | 17 +--
.../bloomfilter/SetOperationsTest.java | 9 +-
.../hasher/DynamicHasherBuilderTest.java | 14 +--
.../bloomfilter/hasher/DynamicHasherTest.java | 15 +--
.../hasher/HashFunctionIdentityImplTest.java | 4 +-
.../hasher/HashFunctionValidatorTest.java | 6 +-
.../bloomfilter/hasher/HasherBuilderTest.java | 12 +-
.../collections4/bloomfilter/hasher/ShapeTest.java | 8 +-
.../bloomfilter/hasher/StaticHasherTest.java | 16 +--
.../hasher/function/AbstractHashFunctionTest.java | 4 +-
.../bloomfilter/hasher/function/MD5CyclicTest.java | 4 +-
.../hasher/function/Murmur128x64CyclicTest.java | 4 +-
.../hasher/function/Murmur32x86IterativeTest.java | 4 +-
.../hasher/function/ObjectsHashIterativeTest.java | 4 +-
.../PredicatedCollectionBuilderTest.java | 40 +++----
.../comparators/BooleanComparatorTest.java | 2 +-
.../functors/AbstractAnyAllOnePredicateTest.java | 13 +--
.../collections4/functors/AbstractClosureTest.java | 7 +-
.../functors/AbstractMockPredicateTest.java | 8 +-
.../collections4/functors/AllPredicateTest.java | 45 ++++----
.../functors/CatchAndRethrowClosureTest.java | 20 ++--
.../collections4/functors/EqualPredicateTest.java | 4 +-
.../collections4/functors/NullPredicateTest.java | 2 +-
.../iterators/FilterListIteratorTest.java | 25 ++---
.../iterators/IteratorEnumerationTest.java | 4 +-
.../iterators/LoopingIteratorTest.java | 42 +++----
.../iterators/LoopingListIteratorTest.java | 4 +-
.../keyvalue/AbstractMapEntryTest.java | 4 +-
.../collections4/keyvalue/DefaultKeyValueTest.java | 4 +-
.../collections4/keyvalue/DefaultMapEntryTest.java | 4 +-
.../collections4/keyvalue/MultiKeyTest.java | 4 +-
.../collections4/keyvalue/TiedMapEntryTest.java | 4 +-
.../keyvalue/UnmodifiableMapEntryTest.java | 4 +-
.../properties/EmptyPropertiesTest.java | 91 ++++++++-------
.../sequence/SequencesComparatorTest.java | 22 ++--
59 files changed, 512 insertions(+), 514 deletions(-)
diff --git a/src/test/java/org/apache/commons/collections4/BagUtilsTest.java
b/src/test/java/org/apache/commons/collections4/BagUtilsTest.java
index 803832f..26b1b46 100644
--- a/src/test/java/org/apache/commons/collections4/BagUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/BagUtilsTest.java
@@ -16,7 +16,7 @@
*/
package org.apache.commons.collections4;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
import org.apache.commons.collections4.bag.HashBag;
import org.apache.commons.collections4.bag.PredicatedBag;
@@ -29,7 +29,7 @@ import org.apache.commons.collections4.bag.TreeBag;
import org.apache.commons.collections4.bag.UnmodifiableBag;
import org.apache.commons.collections4.bag.UnmodifiableSortedBag;
import org.apache.commons.collections4.functors.TruePredicate;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Tests for BagUtils factory methods.
@@ -45,8 +45,7 @@ public class BagUtilsTest {
@Test
public void testSynchronizedBag() {
final Bag<Object> bag = BagUtils.synchronizedBag(new HashBag<>());
- assertTrue("Returned object should be a SynchronizedBag.",
- bag instanceof SynchronizedBag);
+ assertTrue(bag instanceof SynchronizedBag, "Returned object should be
a SynchronizedBag.");
try {
BagUtils.synchronizedBag(null);
fail("Expecting NullPointerException for null bag.");
@@ -58,8 +57,7 @@ public class BagUtilsTest {
@Test
public void testUnmodifiableBag() {
final Bag<Object> bag = BagUtils.unmodifiableBag(new HashBag<>());
- assertTrue("Returned object should be an UnmodifiableBag.",
- bag instanceof UnmodifiableBag);
+ assertTrue(bag instanceof UnmodifiableBag, "Returned object should be
an UnmodifiableBag.");
try {
BagUtils.unmodifiableBag(null);
fail("Expecting NullPointerException for null bag.");
@@ -67,14 +65,13 @@ public class BagUtilsTest {
// expected
}
- assertSame("UnmodifiableBag shall not be decorated", bag,
BagUtils.unmodifiableBag(bag));
+ assertSame(bag, BagUtils.unmodifiableBag(bag), "UnmodifiableBag shall
not be decorated");
}
@Test
public void testPredicatedBag() {
final Bag<Object> bag = BagUtils.predicatedBag(new HashBag<>(),
truePredicate);
- assertTrue("Returned object should be a PredicatedBag.",
- bag instanceof PredicatedBag);
+ assertTrue(bag instanceof PredicatedBag, "Returned object should be a
PredicatedBag.");
try {
BagUtils.predicatedBag(null, truePredicate);
fail("Expecting NullPointerException for null bag.");
@@ -92,8 +89,7 @@ public class BagUtilsTest {
@Test
public void testTransformedBag() {
final Bag<Object> bag = BagUtils.transformingBag(new HashBag<>(),
nopTransformer);
- assertTrue("Returned object should be an TransformedBag.",
- bag instanceof TransformedBag);
+ assertTrue(bag instanceof TransformedBag, "Returned object should be
an TransformedBag.");
try {
BagUtils.transformingBag(null, nopTransformer);
fail("Expecting NullPointerException for null bag.");
@@ -111,8 +107,7 @@ public class BagUtilsTest {
@Test
public void testSynchronizedSortedBag() {
final Bag<Object> bag = BagUtils.synchronizedSortedBag(new
TreeBag<>());
- assertTrue("Returned object should be a SynchronizedSortedBag.",
- bag instanceof SynchronizedSortedBag);
+ assertTrue(bag instanceof SynchronizedSortedBag, "Returned object
should be a SynchronizedSortedBag.");
try {
BagUtils.synchronizedSortedBag(null);
fail("Expecting NullPointerException for null bag.");
@@ -124,8 +119,7 @@ public class BagUtilsTest {
@Test
public void testUnmodifiableSortedBag() {
final SortedBag<Object> bag = BagUtils.unmodifiableSortedBag(new
TreeBag<>());
- assertTrue("Returned object should be an UnmodifiableSortedBag.",
- bag instanceof UnmodifiableSortedBag);
+ assertTrue(bag instanceof UnmodifiableSortedBag, "Returned object
should be an UnmodifiableSortedBag.");
try {
BagUtils.unmodifiableSortedBag(null);
fail("Expecting NullPointerException for null bag.");
@@ -133,14 +127,13 @@ public class BagUtilsTest {
// expected
}
- assertSame("UnmodifiableSortedBag shall not be decorated", bag,
BagUtils.unmodifiableSortedBag(bag));
+ assertSame(bag, BagUtils.unmodifiableSortedBag(bag),
"UnmodifiableSortedBag shall not be decorated");
}
@Test
public void testPredicatedSortedBag() {
final Bag<Object> bag = BagUtils.predicatedSortedBag(new TreeBag<>(),
truePredicate);
- assertTrue("Returned object should be a PredicatedSortedBag.",
- bag instanceof PredicatedSortedBag);
+ assertTrue(bag instanceof PredicatedSortedBag, "Returned object should
be a PredicatedSortedBag.");
try {
BagUtils.predicatedSortedBag(null, truePredicate);
fail("Expecting NullPointerException for null bag.");
@@ -158,8 +151,7 @@ public class BagUtilsTest {
@Test
public void testTransformedSortedBag() {
final Bag<Object> bag = BagUtils.transformingSortedBag(new
TreeBag<>(), nopTransformer);
- assertTrue("Returned object should be an TransformedSortedBag",
- bag instanceof TransformedSortedBag);
+ assertTrue(bag instanceof TransformedSortedBag, "Returned object
should be an TransformedSortedBag");
try {
BagUtils.transformingSortedBag(null, nopTransformer);
fail("Expecting NullPointerException for null bag.");
diff --git
a/src/test/java/org/apache/commons/collections4/ClosureUtilsTest.java
b/src/test/java/org/apache/commons/collections4/ClosureUtilsTest.java
index 4df2121..78e87f2 100644
--- a/src/test/java/org/apache/commons/collections4/ClosureUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/ClosureUtilsTest.java
@@ -16,7 +16,7 @@
*/
package org.apache.commons.collections4;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
import java.util.ArrayList;
import java.util.Collection;
@@ -29,7 +29,7 @@ import
org.apache.commons.collections4.functors.ExceptionClosure;
import org.apache.commons.collections4.functors.FalsePredicate;
import org.apache.commons.collections4.functors.NOPClosure;
import org.apache.commons.collections4.functors.TruePredicate;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Tests the ClosureUtils class.
diff --git
a/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java
b/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java
index 5215549..7ecae7f 100644
--- a/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java
@@ -17,12 +17,13 @@
package org.apache.commons.collections4;
import static
org.apache.commons.collections4.functors.EqualPredicate.equalPredicate;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.ArrayList;
@@ -53,7 +54,6 @@ import
org.apache.commons.collections4.collection.TransformedCollection;
import org.apache.commons.collections4.collection.UnmodifiableCollection;
import org.apache.commons.collections4.functors.DefaultEquator;
import org.apache.commons.collections4.queue.CircularFifoQueue;
-import org.junit.Assert;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -359,23 +359,23 @@ public class CollectionUtilsTest extends MockTestCase {
multiples.add("3");
multiples.add("1");
- assertFalse("containsAll({1},{1,3}) should return false.",
CollectionUtils.containsAll(one, odds));
- assertTrue("containsAll({1,3},{1}) should return true.",
CollectionUtils.containsAll(odds, one));
- assertFalse("containsAll({3},{1,3}) should return false.",
CollectionUtils.containsAll(three, odds));
- assertTrue("containsAll({1,3},{3}) should return true.",
CollectionUtils.containsAll(odds, three));
- assertTrue("containsAll({2},{2}) should return true.",
CollectionUtils.containsAll(two, two));
- assertTrue("containsAll({1,3},{1,3}) should return true.",
CollectionUtils.containsAll(odds, odds));
+ assertFalse(CollectionUtils.containsAll(one, odds),
"containsAll({1},{1,3}) should return false.");
+ assertTrue(CollectionUtils.containsAll(odds, one),
"containsAll({1,3},{1}) should return true.");
+ assertFalse(CollectionUtils.containsAll(three, odds),
"containsAll({3},{1,3}) should return false.");
+ assertTrue(CollectionUtils.containsAll(odds, three),
"containsAll({1,3},{3}) should return true.");
+ assertTrue(CollectionUtils.containsAll(two, two),
"containsAll({2},{2}) should return true.");
+ assertTrue(CollectionUtils.containsAll(odds, odds),
"containsAll({1,3},{1,3}) should return true.");
- assertFalse("containsAll({2},{1,3}) should return false.",
CollectionUtils.containsAll(two, odds));
- assertFalse("containsAll({1,3},{2}) should return false.",
CollectionUtils.containsAll(odds, two));
- assertFalse("containsAll({1},{3}) should return false.",
CollectionUtils.containsAll(one, three));
- assertFalse("containsAll({3},{1}) should return false.",
CollectionUtils.containsAll(three, one));
- assertTrue("containsAll({1,3},{}) should return true.",
CollectionUtils.containsAll(odds, empty));
- assertFalse("containsAll({},{1,3}) should return false.",
CollectionUtils.containsAll(empty, odds));
- assertTrue("containsAll({},{}) should return true.",
CollectionUtils.containsAll(empty, empty));
+ assertFalse(CollectionUtils.containsAll(two, odds),
"containsAll({2},{1,3}) should return false.");
+ assertFalse(CollectionUtils.containsAll(odds, two),
"containsAll({1,3},{2}) should return false.");
+ assertFalse(CollectionUtils.containsAll(one, three),
"containsAll({1},{3}) should return false.");
+ assertFalse(CollectionUtils.containsAll(three, one),
"containsAll({3},{1}) should return false.");
+ assertTrue(CollectionUtils.containsAll(odds, empty),
"containsAll({1,3},{}) should return true.");
+ assertFalse(CollectionUtils.containsAll(empty, odds),
"containsAll({},{1,3}) should return false.");
+ assertTrue(CollectionUtils.containsAll(empty, empty),
"containsAll({},{}) should return true.");
- assertTrue("containsAll({1,3},{1,3,1}) should return true.",
CollectionUtils.containsAll(odds, multiples));
- assertTrue("containsAll({1,3,1},{1,3,1}) should return true.",
CollectionUtils.containsAll(odds, odds));
+ assertTrue(CollectionUtils.containsAll(odds, multiples),
"containsAll({1,3},{1,3,1}) should return true.");
+ assertTrue(CollectionUtils.containsAll(odds, odds),
"containsAll({1,3,1},{1,3,1}) should return true.");
}
@Test
@@ -396,20 +396,20 @@ public class CollectionUtilsTest extends MockTestCase {
odds.add("3");
final String[] oddsArr = {"1", "3"};
- assertTrue("containsAny({1},{1,3}) should return true.",
CollectionUtils.containsAny(one, oddsArr));
- assertTrue("containsAny({1,3},{1}) should return true.",
CollectionUtils.containsAny(odds, oneArr));
- assertTrue("containsAny({3},{1,3}) should return true.",
CollectionUtils.containsAny(three, oddsArr));
- assertTrue("containsAny({1,3},{3}) should return true.",
CollectionUtils.containsAny(odds, threeArr));
- assertTrue("containsAny({2},{2}) should return true.",
CollectionUtils.containsAny(two, twoArr));
- assertTrue("containsAny({1,3},{1,3}) should return true.",
CollectionUtils.containsAny(odds, oddsArr));
+ assertTrue(CollectionUtils.containsAny(one, oddsArr),
"containsAny({1},{1,3}) should return true.");
+ assertTrue(CollectionUtils.containsAny(odds, oneArr),
"containsAny({1,3},{1}) should return true.");
+ assertTrue(CollectionUtils.containsAny(three, oddsArr),
"containsAny({3},{1,3}) should return true.");
+ assertTrue(CollectionUtils.containsAny(odds, threeArr),
"containsAny({1,3},{3}) should return true.");
+ assertTrue(CollectionUtils.containsAny(two, twoArr),
"containsAny({2},{2}) should return true.");
+ assertTrue(CollectionUtils.containsAny(odds, oddsArr),
"containsAny({1,3},{1,3}) should return true.");
- assertFalse("containsAny({2},{1,3}) should return false.",
CollectionUtils.containsAny(two, oddsArr));
- assertFalse("containsAny({1,3},{2}) should return false.",
CollectionUtils.containsAny(odds, twoArr));
- assertFalse("containsAny({1},{3}) should return false.",
CollectionUtils.containsAny(one, threeArr));
- assertFalse("containsAny({3},{1}) should return false.",
CollectionUtils.containsAny(three, oneArr));
- assertFalse("containsAny({1,3},{}) should return false.",
CollectionUtils.containsAny(odds, emptyArr));
- assertFalse("containsAny({},{1,3}) should return false.",
CollectionUtils.containsAny(empty, oddsArr));
- assertFalse("containsAny({},{}) should return false.",
CollectionUtils.containsAny(empty, emptyArr));
+ assertFalse(CollectionUtils.containsAny(two, oddsArr),
"containsAny({2},{1,3}) should return false.");
+ assertFalse(CollectionUtils.containsAny(odds, twoArr),
"containsAny({1,3},{2}) should return false.");
+ assertFalse(CollectionUtils.containsAny(one, threeArr),
"containsAny({1},{3}) should return false.");
+ assertFalse(CollectionUtils.containsAny(three, oneArr),
"containsAny({3},{1}) should return false.");
+ assertFalse(CollectionUtils.containsAny(odds, emptyArr),
"containsAny({1,3},{}) should return false.");
+ assertFalse(CollectionUtils.containsAny(empty, oddsArr),
"containsAny({},{1,3}) should return false.");
+ assertFalse(CollectionUtils.containsAny(empty, emptyArr),
"containsAny({},{}) should return false.");
}
@Test
@@ -425,20 +425,20 @@ public class CollectionUtilsTest extends MockTestCase {
odds.add("1");
odds.add("3");
- assertTrue("containsAny({1},{1,3}) should return true.",
CollectionUtils.containsAny(one, odds));
- assertTrue("containsAny({1,3},{1}) should return true.",
CollectionUtils.containsAny(odds, one));
- assertTrue("containsAny({3},{1,3}) should return true.",
CollectionUtils.containsAny(three, odds));
- assertTrue("containsAny({1,3},{3}) should return true.",
CollectionUtils.containsAny(odds, three));
- assertTrue("containsAny({2},{2}) should return true.",
CollectionUtils.containsAny(two, two));
- assertTrue("containsAny({1,3},{1,3}) should return true.",
CollectionUtils.containsAny(odds, odds));
+ assertTrue(CollectionUtils.containsAny(one, odds),
"containsAny({1},{1,3}) should return true.");
+ assertTrue(CollectionUtils.containsAny(odds, one),
"containsAny({1,3},{1}) should return true.");
+ assertTrue(CollectionUtils.containsAny(three, odds),
"containsAny({3},{1,3}) should return true.");
+ assertTrue(CollectionUtils.containsAny(odds, three),
"containsAny({1,3},{3}) should return true.");
+ assertTrue(CollectionUtils.containsAny(two, two),
"containsAny({2},{2}) should return true.");
+ assertTrue(CollectionUtils.containsAny(odds, odds),
"containsAny({1,3},{1,3}) should return true.");
- assertFalse("containsAny({2},{1,3}) should return false.",
CollectionUtils.containsAny(two, odds));
- assertFalse("containsAny({1,3},{2}) should return false.",
CollectionUtils.containsAny(odds, two));
- assertFalse("containsAny({1},{3}) should return false.",
CollectionUtils.containsAny(one, three));
- assertFalse("containsAny({3},{1}) should return false.",
CollectionUtils.containsAny(three, one));
- assertFalse("containsAny({1,3},{}) should return false.",
CollectionUtils.containsAny(odds, empty));
- assertFalse("containsAny({},{1,3}) should return false.",
CollectionUtils.containsAny(empty, odds));
- assertFalse("containsAny({},{}) should return false.",
CollectionUtils.containsAny(empty, empty));
+ assertFalse(CollectionUtils.containsAny(two, odds),
"containsAny({2},{1,3}) should return false.");
+ assertFalse(CollectionUtils.containsAny(odds, two),
"containsAny({1,3},{2}) should return false.");
+ assertFalse(CollectionUtils.containsAny(one, three),
"containsAny({1},{3}) should return false.");
+ assertFalse(CollectionUtils.containsAny(three, one),
"containsAny({3},{1}) should return false.");
+ assertFalse(CollectionUtils.containsAny(odds, empty),
"containsAny({1,3},{}) should return false.");
+ assertFalse(CollectionUtils.containsAny(empty, odds),
"containsAny({},{1,3}) should return false.");
+ assertFalse(CollectionUtils.containsAny(empty, empty),
"containsAny({},{}) should return false.");
}
@Test
@@ -1040,7 +1040,7 @@ public class CollectionUtilsTest extends MockTestCase {
public void predicatedCollection() {
final Predicate<Object> predicate =
PredicateUtils.instanceofPredicate(Integer.class);
final Collection<Number> collection =
CollectionUtils.predicatedCollection(new ArrayList<Number>(), predicate);
- assertTrue("returned object should be a PredicatedCollection",
collection instanceof PredicatedCollection);
+ assertTrue(collection instanceof PredicatedCollection, "returned
object should be a PredicatedCollection");
}
@Test
@@ -1108,7 +1108,7 @@ public class CollectionUtilsTest extends MockTestCase {
// rejected contains 1, 3, and 4
final Integer[] expected = {1, 3, 4};
- Assert.assertArrayEquals(expected, rejected.toArray());
+ assertArrayEquals(expected, rejected.toArray());
output.clear();
rejected.clear();
@@ -1218,26 +1218,26 @@ public class CollectionUtilsTest extends MockTestCase {
@Test
public void testCollate() {
List<Integer> result = CollectionUtils.collate(emptyCollection,
emptyCollection);
- assertEquals("Merge empty with empty", 0, result.size());
+ assertEquals(0, result.size(), "Merge empty with empty");
result = CollectionUtils.collate(collectionA, emptyCollection);
- assertEquals("Merge empty with non-empty", collectionA, result);
+ assertEquals(collectionA, result, "Merge empty with non-empty");
List<Integer> result1 = CollectionUtils.collate(collectionD,
collectionE);
List<Integer> result2 = CollectionUtils.collate(collectionE,
collectionD);
- assertEquals("Merge two lists 1", result1, result2);
+ assertEquals(result1, result2, "Merge two lists 1");
final List<Integer> combinedList = new ArrayList<>(collectionD);
combinedList.addAll(collectionE);
Collections.sort(combinedList);
- assertEquals("Merge two lists 2", combinedList, result2);
+ assertEquals(combinedList, result2, "Merge two lists 2");
final Comparator<Integer> reverseComparator =
ComparatorUtils.reversedComparator(ComparatorUtils.<Integer>naturalComparator());
result = CollectionUtils.collate(emptyCollection, emptyCollection,
reverseComparator);
- assertEquals("Comparator Merge empty with empty", 0, result.size());
+ assertEquals(0, result.size(), "Comparator Merge empty with empty");
Collections.reverse((List<Integer>) collectionD);
Collections.reverse((List<Integer>) collectionE);
@@ -1245,22 +1245,22 @@ public class CollectionUtilsTest extends MockTestCase {
result1 = CollectionUtils.collate(collectionD, collectionE,
reverseComparator);
result2 = CollectionUtils.collate(collectionE, collectionD,
reverseComparator);
- assertEquals("Comparator Merge two lists 1", result1, result2);
- assertEquals("Comparator Merge two lists 2", combinedList, result2);
+ assertEquals(result1, result2, "Comparator Merge two lists 1");
+ assertEquals(combinedList, result2, "Comparator Merge two lists 2");
}
@Test
public void testCollateIgnoreDuplicates() {
final List<Integer> result1 = CollectionUtils.collate(collectionD,
collectionE, false);
final List<Integer> result2 = CollectionUtils.collate(collectionE,
collectionD, false);
- assertEquals("Merge two lists 1 - ignore duplicates", result1,
result2);
+ assertEquals(result1, result2, "Merge two lists 1 - ignore
duplicates");
final Set<Integer> combinedSet = new HashSet<>(collectionD);
combinedSet.addAll(collectionE);
final List<Integer> combinedList = new ArrayList<>(combinedSet);
Collections.sort(combinedList);
- assertEquals("Merge two lists 2 - ignore duplicates", combinedList,
result2);
+ assertEquals(combinedList, result2, "Merge two lists 2 - ignore
duplicates");
}
@Test
@@ -2224,7 +2224,7 @@ public class CollectionUtilsTest extends MockTestCase {
@Deprecated
public void testSynchronizedCollection() {
final Collection<Object> col =
CollectionUtils.synchronizedCollection(new ArrayList<>());
- assertTrue("Returned object should be a SynchronizedCollection.", col
instanceof SynchronizedCollection);
+ assertTrue(col instanceof SynchronizedCollection, "Returned object
should be a SynchronizedCollection.");
try {
CollectionUtils.synchronizedCollection(null);
fail("Expecting NullPointerException for null collection.");
@@ -2238,7 +2238,7 @@ public class CollectionUtilsTest extends MockTestCase {
public void testTransformedCollection() {
final Transformer<Object, Object> transformer =
TransformerUtils.nopTransformer();
final Collection<Object> collection =
CollectionUtils.transformingCollection(new ArrayList<>(), transformer);
- assertTrue("returned object should be a TransformedCollection",
collection instanceof TransformedCollection);
+ assertTrue(collection instanceof TransformedCollection, "returned
object should be a TransformedCollection");
}
@Test
@@ -2283,7 +2283,7 @@ public class CollectionUtilsTest extends MockTestCase {
@Deprecated
public void testUnmodifiableCollection() {
final Collection<Object> col =
CollectionUtils.unmodifiableCollection(new ArrayList<>());
- assertTrue("Returned object should be a UnmodifiableCollection.", col
instanceof UnmodifiableCollection);
+ assertTrue(col instanceof UnmodifiableCollection, "Returned object
should be a UnmodifiableCollection.");
try {
CollectionUtils.unmodifiableCollection(null);
fail("Expecting NullPointerException for null collection.");
diff --git
a/src/test/java/org/apache/commons/collections4/ComparatorUtilsTest.java
b/src/test/java/org/apache/commons/collections4/ComparatorUtilsTest.java
index ae9af09..f66e279 100644
--- a/src/test/java/org/apache/commons/collections4/ComparatorUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/ComparatorUtilsTest.java
@@ -16,13 +16,13 @@
*/
package org.apache.commons.collections4;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.util.Comparator;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Tests ComparatorUtils.
diff --git
a/src/test/java/org/apache/commons/collections4/EnumerationUtilsTest.java
b/src/test/java/org/apache/commons/collections4/EnumerationUtilsTest.java
index 0c37ca5..687e543 100644
--- a/src/test/java/org/apache/commons/collections4/EnumerationUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/EnumerationUtilsTest.java
@@ -16,10 +16,10 @@
*/
package org.apache.commons.collections4;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.fail;
import java.util.ArrayList;
import java.util.Enumeration;
@@ -29,7 +29,7 @@ import java.util.List;
import java.util.StringTokenizer;
import java.util.Vector;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Tests EnumerationUtils.
diff --git
a/src/test/java/org/apache/commons/collections4/FactoryUtilsTest.java
b/src/test/java/org/apache/commons/collections4/FactoryUtilsTest.java
index df8e9a7..36ba76b 100644
--- a/src/test/java/org/apache/commons/collections4/FactoryUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/FactoryUtilsTest.java
@@ -16,13 +16,13 @@
*/
package org.apache.commons.collections4;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNotSame;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.IOException;
diff --git
a/src/test/java/org/apache/commons/collections4/FluentIterableTest.java
b/src/test/java/org/apache/commons/collections4/FluentIterableTest.java
index 8615f8f..9e9b2f7 100644
--- a/src/test/java/org/apache/commons/collections4/FluentIterableTest.java
+++ b/src/test/java/org/apache/commons/collections4/FluentIterableTest.java
@@ -16,13 +16,13 @@
*/
package org.apache.commons.collections4;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.util.ArrayList;
import java.util.Arrays;
@@ -34,8 +34,8 @@ import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Tests for FluentIterable.
@@ -69,7 +69,7 @@ public class FluentIterableTest {
*/
private Iterable<Integer> emptyIterable = null;
- @Before
+ @BeforeEach
public void setUp() {
final Collection<Integer> collectionA = new ArrayList<>();
collectionA.add(1);
diff --git
a/src/test/java/org/apache/commons/collections4/IterableUtilsTest.java
b/src/test/java/org/apache/commons/collections4/IterableUtilsTest.java
index 2858352..656ce20 100644
--- a/src/test/java/org/apache/commons/collections4/IterableUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/IterableUtilsTest.java
@@ -17,12 +17,13 @@
package org.apache.commons.collections4;
import static
org.apache.commons.collections4.functors.EqualPredicate.equalPredicate;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.ArrayList;
@@ -35,7 +36,6 @@ import java.util.List;
import java.util.Set;
import org.apache.commons.collections4.bag.HashBag;
-import org.junit.Assert;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -424,7 +424,7 @@ public class IterableUtilsTest {
// second partition contains 1, 3, and 4
final Integer[] expected = {1, 3, 4};
partition = partitions.get(1);
- Assert.assertArrayEquals(expected, partition.toArray());
+ assertArrayEquals(expected, partition.toArray());
partitions = IterableUtils.partition((List<Integer>) null, EQUALS_TWO);
assertEquals(2, partitions.size());
@@ -466,7 +466,7 @@ public class IterableUtilsTest {
// third partition contains 1 and 3
final Integer[] expected = {1, 3};
partition = partitions.get(2);
- Assert.assertArrayEquals(expected, partition.toArray());
+ assertArrayEquals(expected, partition.toArray());
try {
IterableUtils.partition(input, EQUALS_TWO, null);
diff --git
a/src/test/java/org/apache/commons/collections4/IteratorUtilsTest.java
b/src/test/java/org/apache/commons/collections4/IteratorUtilsTest.java
index 039d561..71294e5 100644
--- a/src/test/java/org/apache/commons/collections4/IteratorUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/IteratorUtilsTest.java
@@ -21,12 +21,12 @@ import static
org.apache.commons.collections4.functors.TruePredicate.INSTANCE;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.ArrayList;
@@ -460,7 +460,7 @@ public class IteratorUtilsTest {
assertTrue(expected > 0);
// single use iterator
- assertFalse("should not be able to iterate twice",
IteratorUtils.asIterable(iterator).iterator().hasNext());
+ assertFalse(IteratorUtils.asIterable(iterator).iterator().hasNext(),
"should not be able to iterate twice");
}
@Test
@@ -479,7 +479,7 @@ public class IteratorUtilsTest {
vector.addElement("zero");
vector.addElement("one");
final Enumeration<String> en = vector.elements();
- assertTrue("create instance fail", IteratorUtils.asIterator(en)
instanceof Iterator);
+ assertTrue(IteratorUtils.asIterator(en) instanceof Iterator, "create
instance fail");
assertThrows(NullPointerException.class, () ->
IteratorUtils.asIterator(null));
}
@@ -491,7 +491,7 @@ public class IteratorUtilsTest {
vector.addElement("test");
vector.addElement("one");
final Enumeration<String> en = vector.elements();
- assertTrue("create instance fail", IteratorUtils.asIterator(en, coll)
instanceof Iterator);
+ assertTrue(IteratorUtils.asIterator(en, coll) instanceof Iterator,
"create instance fail");
try {
IteratorUtils.asIterator(null, coll);
} catch (final NullPointerException npe) {
@@ -545,9 +545,9 @@ public class IteratorUtilsTest {
public void testChainedIterator() {
final ArrayList arrayList = new ArrayList();
final Iterator ie = arrayList.iterator();
- assertTrue("create instance fail", IteratorUtils.chainedIterator(ie)
instanceof Iterator);
+ assertTrue(IteratorUtils.chainedIterator(ie) instanceof Iterator,
"create instance fail");
final Collection<Iterator<?>> coll = new ArrayList();
- assertTrue("create instance fail", IteratorUtils.chainedIterator(coll)
instanceof Iterator);
+ assertTrue(IteratorUtils.chainedIterator(coll) instanceof Iterator,
"create instance fail");
}
@@ -861,8 +861,8 @@ public class IteratorUtilsTest {
final List arrayList = new ArrayList();
arrayList.add("test");
final Predicate predicate = INSTANCE;
- assertTrue("create instance fail",
- IteratorUtils.filteredListIterator(arrayList.listIterator(),
predicate) instanceof ListIterator);
+
assertTrue(IteratorUtils.filteredListIterator(arrayList.listIterator(),
predicate) instanceof ListIterator,
+ "create instance fail");
try {
IteratorUtils.filteredListIterator(null, predicate);
} catch (final NullPointerException npe) {
@@ -985,25 +985,23 @@ public class IteratorUtilsTest {
final Node[] nodes = createNodes();
final NodeList nodeList = createNodeList(nodes);
- assertTrue("returns empty iterator when null passed",
IteratorUtils.getIterator(null) instanceof EmptyIterator);
- assertTrue("returns Iterator when Iterator directly ",
- IteratorUtils.getIterator(iterableA.iterator()) instanceof
Iterator);
- assertTrue("returns Iterator when iterable passed",
IteratorUtils.getIterator(iterableA) instanceof Iterator);
- assertTrue("returns ObjectArrayIterator when Object array passed",
- IteratorUtils.getIterator(objArray) instanceof
ObjectArrayIterator);
- assertTrue("returns Iterator when Map passed",
IteratorUtils.getIterator(inMap) instanceof Iterator);
- assertTrue("returns NodeListIterator when nodeList passed",
- IteratorUtils.getIterator(nodeList) instanceof
NodeListIterator);
- assertTrue("returns EnumerationIterator when Enumeration passed",
- IteratorUtils.getIterator(new Vector().elements()) instanceof
EnumerationIterator);
+ assertTrue(IteratorUtils.getIterator(null) instanceof EmptyIterator,
"returns empty iterator when null passed");
+ assertTrue(IteratorUtils.getIterator(iterableA.iterator()) instanceof
Iterator, "returns Iterator when Iterator directly ");
+ assertTrue(IteratorUtils.getIterator(iterableA) instanceof Iterator,
"returns Iterator when iterable passed");
+ assertTrue(IteratorUtils.getIterator(objArray) instanceof
ObjectArrayIterator,
+ "returns ObjectArrayIterator when Object array passed");
+ assertTrue(IteratorUtils.getIterator(inMap) instanceof Iterator,
"returns Iterator when Map passed");
+ assertTrue(IteratorUtils.getIterator(nodeList) instanceof
NodeListIterator, "returns NodeListIterator when nodeList passed");
+ assertTrue(IteratorUtils.getIterator(new Vector().elements())
instanceof EnumerationIterator,
+ "returns EnumerationIterator when Enumeration passed");
final Node node1 = createMock(Node.class);
- assertTrue("returns NodeListIterator when nodeList passed",
- IteratorUtils.getIterator(node1) instanceof NodeListIterator);
+ assertTrue(IteratorUtils.getIterator(node1) instanceof
NodeListIterator,
+ "returns NodeListIterator when nodeList passed");
final Dictionary dic = createMock(Dictionary.class);
- assertTrue("returns EnumerationIterator when Dictionary passed",
- IteratorUtils.getIterator(dic) instanceof EnumerationIterator);
+ assertTrue(IteratorUtils.getIterator(dic) instanceof
EnumerationIterator,
+ "returns EnumerationIterator when Dictionary passed");
final int[] arr = new int[8];
- assertTrue("returns ArrayIterator when array passed",
IteratorUtils.getIterator(arr) instanceof ArrayIterator);
+ assertTrue(IteratorUtils.getIterator(arr) instanceof ArrayIterator,
"returns ArrayIterator when array passed");
}
@Test
@@ -1030,7 +1028,7 @@ public class IteratorUtilsTest {
final Collection coll = new ArrayList();
coll.add("test");
final Iterator ie = arrayList.iterator();
- assertTrue("create instance fail", IteratorUtils.loopingIterator(coll)
instanceof ResettableIterator);
+ assertTrue(IteratorUtils.loopingIterator(coll) instanceof
ResettableIterator, "create instance fail");
assertThrows(NullPointerException.class, () ->
IteratorUtils.loopingIterator(null));
}
@@ -1039,7 +1037,7 @@ public class IteratorUtilsTest {
final ArrayList arrayList = new ArrayList();
arrayList.add("test");
final Iterator ie = arrayList.iterator();
- assertTrue("create instance fail",
IteratorUtils.loopingListIterator(arrayList) instanceof ResettableIterator);
+ assertTrue(IteratorUtils.loopingListIterator(arrayList) instanceof
ResettableIterator, "create instance fail");
assertThrows(NullPointerException.class, () ->
IteratorUtils.loopingListIterator(null));
}
@@ -1065,7 +1063,7 @@ public class IteratorUtilsTest {
assertTrue(expectedNodeIndex > 0);
// single use iterator
- assertFalse("should not be able to iterate twice",
IteratorUtils.asIterable(iterator).iterator().hasNext());
+ assertFalse(IteratorUtils.asIterable(iterator).iterator().hasNext(),
"should not be able to iterate twice");
try {
IteratorUtils.nodeListIterator((Node) null);
@@ -1094,7 +1092,7 @@ public class IteratorUtilsTest {
assertTrue(expectedNodeIndex > 0);
// single use iterator
- assertFalse("should not be able to iterate twice",
IteratorUtils.asIterable(iterator).iterator().hasNext());
+ assertFalse(IteratorUtils.asIterable(iterator).iterator().hasNext(),
"should not be able to iterate twice");
try {
IteratorUtils.nodeListIterator((NodeList) null);
@@ -1106,14 +1104,14 @@ public class IteratorUtilsTest {
@Test
public void testObjectGraphIterator() {
- assertTrue("create instance fail",
IteratorUtils.objectGraphIterator(null, null) instanceof Iterator);
+ assertTrue(IteratorUtils.objectGraphIterator(null, null) instanceof
Iterator, "create instance fail");
}
@Test
public void testPeekingIterator() {
final ArrayList arrayList = new ArrayList();
final Iterator ie = arrayList.iterator();
- assertTrue("create instance fail", IteratorUtils.peekingIterator(ie)
instanceof Iterator);
+ assertTrue(IteratorUtils.peekingIterator(ie) instanceof Iterator,
"create instance fail");
assertThrows(NullPointerException.class, () ->
IteratorUtils.peekingIterator(null));
}
@@ -1122,18 +1120,18 @@ public class IteratorUtilsTest {
public void testPushBackIterator() {
final ArrayList arrayList = new ArrayList();
final Iterator ie = arrayList.iterator();
- assertTrue("create instance fail", IteratorUtils.pushbackIterator(ie)
instanceof Iterator);
+ assertTrue(IteratorUtils.pushbackIterator(ie) instanceof Iterator,
"create instance fail");
assertThrows(NullPointerException.class, () ->
IteratorUtils.pushbackIterator(null));
}
@Test
public void testSingletonIterator() {
- assertTrue("create instance fail", IteratorUtils.singletonIterator(new
Object()) instanceof ResettableIterator);
+ assertTrue(IteratorUtils.singletonIterator(new Object()) instanceof
ResettableIterator, "create instance fail");
}
@Test
public void testSingletonListIterator() {
- assertTrue("create instance fail",
IteratorUtils.singletonListIterator(new Object()) instanceof Iterator);
+ assertTrue(IteratorUtils.singletonListIterator(new Object())
instanceof Iterator, "create instance fail");
}
@Test
@@ -1411,7 +1409,7 @@ public class IteratorUtilsTest {
public void testUnmodifiableMapIterator() {
final Set<?> set = new LinkedHashSet<>();
final MapIterator ie = new EntrySetToMapIteratorAdapter(set);
- assertTrue("create instance fail",
IteratorUtils.unmodifiableMapIterator(ie) instanceof MapIterator);
+ assertTrue(IteratorUtils.unmodifiableMapIterator(ie) instanceof
MapIterator, "create instance fail");
assertThrows(NullPointerException.class, () ->
IteratorUtils.unmodifiableMapIterator(null));
}
@@ -1420,7 +1418,7 @@ public class IteratorUtilsTest {
public void testZippingIterator() {
final ArrayList arrayList = new ArrayList();
final Iterator ie = arrayList.iterator();
- assertTrue("create instance fail", IteratorUtils.zippingIterator(ie,
ie, ie) instanceof ZippingIterator);
- assertTrue("create instance fail", IteratorUtils.zippingIterator(ie,
ie) instanceof ZippingIterator);
+ assertTrue(IteratorUtils.zippingIterator(ie, ie, ie) instanceof
ZippingIterator, "create instance fail");
+ assertTrue(IteratorUtils.zippingIterator(ie, ie) instanceof
ZippingIterator, "create instance fail");
}
}
diff --git a/src/test/java/org/apache/commons/collections4/ListUtilsTest.java
b/src/test/java/org/apache/commons/collections4/ListUtilsTest.java
index 78c3917..4ab2c6d 100644
--- a/src/test/java/org/apache/commons/collections4/ListUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/ListUtilsTest.java
@@ -16,7 +16,7 @@
*/
package org.apache.commons.collections4;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
import java.util.ArrayList;
import java.util.Arrays;
@@ -27,8 +27,8 @@ import java.util.List;
import org.apache.commons.collections4.functors.EqualPredicate;
import org.apache.commons.collections4.list.PredicatedList;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Tests for ListUtils.
@@ -46,7 +46,7 @@ public class ListUtilsTest {
private String[] fullArray;
private List<String> fullList;
- @Before
+ @BeforeEach
public void setUp() {
fullArray = new String[]{a, b, c, d, e};
fullList = new ArrayList<>(Arrays.asList(fullArray));
@@ -58,7 +58,7 @@ public class ListUtilsTest {
@Test
public void testIntersectNonEmptyWithEmptyList() {
final List<String> empty = Collections.<String>emptyList();
- assertTrue("result not empty", ListUtils.intersection(empty,
fullList).isEmpty());
+ assertTrue(ListUtils.intersection(empty, fullList).isEmpty(), "result
not empty");
}
/**
@@ -67,7 +67,7 @@ public class ListUtilsTest {
@Test
public void testIntersectEmptyWithEmptyList() {
final List<?> empty = Collections.EMPTY_LIST;
- assertTrue("result not empty", ListUtils.intersection(empty,
empty).isEmpty());
+ assertTrue(ListUtils.intersection(empty, empty).isEmpty(), "result not
empty");
}
/**
@@ -124,7 +124,7 @@ public class ListUtilsTest {
public void testPredicatedList() {
final Predicate<Object> predicate = o -> o instanceof String;
final List<Object> list = ListUtils.predicatedList(new ArrayList<>(),
predicate);
- assertTrue("returned object should be a PredicatedList", list
instanceof PredicatedList);
+ assertTrue(list instanceof PredicatedList, "returned object should be
a PredicatedList");
try {
ListUtils.predicatedList(new ArrayList<>(), null);
fail("Expecting IllegalArgumentException for null predicate.");
diff --git
a/src/test/java/org/apache/commons/collections4/MultiMapUtilsTest.java
b/src/test/java/org/apache/commons/collections4/MultiMapUtilsTest.java
index fca9123..c2125ad 100644
--- a/src/test/java/org/apache/commons/collections4/MultiMapUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/MultiMapUtilsTest.java
@@ -16,11 +16,11 @@
*/
package org.apache.commons.collections4;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.util.Arrays;
import java.util.Collection;
@@ -29,7 +29,7 @@ import java.util.List;
import java.util.Set;
import org.apache.commons.collections4.multimap.ArrayListValuedHashMap;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Tests for MultiMapUtils
diff --git
a/src/test/java/org/apache/commons/collections4/MultiSetUtilsTest.java
b/src/test/java/org/apache/commons/collections4/MultiSetUtilsTest.java
index 85c07af..95bc6b6 100644
--- a/src/test/java/org/apache/commons/collections4/MultiSetUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/MultiSetUtilsTest.java
@@ -16,14 +16,14 @@
*/
package org.apache.commons.collections4;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
import java.util.Arrays;
import org.apache.commons.collections4.multiset.HashMultiSet;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Tests for MultiSetUtils.
@@ -34,7 +34,7 @@ public class MultiSetUtilsTest {
private String[] fullArray;
private MultiSet<String> multiSet;
- @Before
+ @BeforeEach
public void setUp() {
fullArray = new String[]{
"a", "a", "b", "c", "d", "d", "d"
diff --git
a/src/test/java/org/apache/commons/collections4/PredicateUtilsTest.java
b/src/test/java/org/apache/commons/collections4/PredicateUtilsTest.java
index 087fa74..6bde3cb 100644
--- a/src/test/java/org/apache/commons/collections4/PredicateUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/PredicateUtilsTest.java
@@ -18,7 +18,7 @@ package org.apache.commons.collections4;
import static org.apache.commons.collections4.functors.NullPredicate.*;
import static org.apache.commons.collections4.functors.TruePredicate.*;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
import java.util.ArrayList;
import java.util.Arrays;
diff --git a/src/test/java/org/apache/commons/collections4/QueueUtilsTest.java
b/src/test/java/org/apache/commons/collections4/QueueUtilsTest.java
index 8842ff7..09d5f71 100644
--- a/src/test/java/org/apache/commons/collections4/QueueUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/QueueUtilsTest.java
@@ -16,9 +16,9 @@
*/
package org.apache.commons.collections4;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.util.LinkedList;
import java.util.Queue;
@@ -28,7 +28,7 @@ import org.apache.commons.collections4.queue.PredicatedQueue;
import org.apache.commons.collections4.queue.SynchronizedQueue;
import org.apache.commons.collections4.queue.TransformedQueue;
import org.apache.commons.collections4.queue.UnmodifiableQueue;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Tests for QueueUtils factory methods.
@@ -44,7 +44,7 @@ public class QueueUtilsTest {
@Test
public void testSynchronizedQueue() {
final Queue<Object> queue = QueueUtils.synchronizedQueue(new
LinkedList<>());
- assertTrue("Returned object should be a SynchronizedQueue.", queue
instanceof SynchronizedQueue);
+ assertTrue(queue instanceof SynchronizedQueue, "Returned object should
be a SynchronizedQueue.");
try {
QueueUtils.synchronizedQueue(null);
fail("Expecting NullPointerException for null queue.");
@@ -56,7 +56,7 @@ public class QueueUtilsTest {
@Test
public void testUnmodifiableQueue() {
final Queue<Object> queue = QueueUtils.unmodifiableQueue(new
LinkedList<>());
- assertTrue("Returned object should be an UnmodifiableQueue.", queue
instanceof UnmodifiableQueue);
+ assertTrue(queue instanceof UnmodifiableQueue, "Returned object should
be an UnmodifiableQueue.");
try {
QueueUtils.unmodifiableQueue(null);
fail("Expecting NullPointerException for null queue.");
@@ -64,13 +64,13 @@ public class QueueUtilsTest {
// expected
}
- assertSame("UnmodifiableQueue shall not be decorated", queue,
QueueUtils.unmodifiableQueue(queue));
+ assertSame(queue, QueueUtils.unmodifiableQueue(queue),
"UnmodifiableQueue shall not be decorated");
}
@Test
public void testPredicatedQueue() {
final Queue<Object> queue = QueueUtils.predicatedQueue(new
LinkedList<>(), truePredicate);
- assertTrue("Returned object should be a PredicatedQueue.", queue
instanceof PredicatedQueue);
+ assertTrue(queue instanceof PredicatedQueue, "Returned object should
be a PredicatedQueue.");
try {
QueueUtils.predicatedQueue(null, truePredicate);
fail("Expecting NullPointerException for null queue.");
@@ -88,7 +88,7 @@ public class QueueUtilsTest {
@Test
public void testTransformedQueue() {
final Queue<Object> queue = QueueUtils.transformingQueue(new
LinkedList<>(), nopTransformer);
- assertTrue("Returned object should be an TransformedQueue.", queue
instanceof TransformedQueue);
+ assertTrue(queue instanceof TransformedQueue, "Returned object should
be an TransformedQueue.");
try {
QueueUtils.transformingQueue(null, nopTransformer);
fail("Expecting NullPointerException for null queue.");
@@ -106,8 +106,8 @@ public class QueueUtilsTest {
@Test
public void testEmptyQueue() {
final Queue<Object> queue = QueueUtils.emptyQueue();
- assertTrue("Returned object should be an UnmodifiableQueue.", queue
instanceof UnmodifiableQueue);
- assertTrue("Returned queue is not empty.", queue.isEmpty());
+ assertTrue(queue instanceof UnmodifiableQueue, "Returned object should
be an UnmodifiableQueue.");
+ assertTrue(queue.isEmpty(), "Returned queue is not empty.");
try {
queue.add(new Object());
diff --git a/src/test/java/org/apache/commons/collections4/SetUtilsTest.java
b/src/test/java/org/apache/commons/collections4/SetUtilsTest.java
index 7936129..a67143b 100644
--- a/src/test/java/org/apache/commons/collections4/SetUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/SetUtilsTest.java
@@ -16,13 +16,13 @@
*/
package org.apache.commons.collections4;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.util.Arrays;
import java.util.Collection;
@@ -31,8 +31,8 @@ import java.util.Set;
import org.apache.commons.collections4.SetUtils.SetView;
import org.apache.commons.collections4.set.PredicatedSet;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Tests for SetUtils.
@@ -131,7 +131,7 @@ public class SetUtilsTest {
}
}
- @Before
+ @BeforeEach
public void setUp() {
setA = new HashSet<>();
setA.add(1);
@@ -191,26 +191,26 @@ public class SetUtilsTest {
@Test
public void testHashSet() {
final Set<?> set1 = SetUtils.unmodifiableSet();
- assertTrue("set is empty", set1.isEmpty());
+ assertTrue(set1.isEmpty(), "set is empty");
final Set<Integer> set2 = SetUtils.hashSet(1, 2, 2, 3);
- assertEquals("set has 3 elements", 3, set2.size());
- assertTrue("set contains 1", set2.contains(1));
- assertTrue("set contains 2", set2.contains(2));
- assertTrue("set contains 3", set2.contains(3));
+ assertEquals(3, set2.size(), "set has 3 elements");
+ assertTrue(set2.contains(1), "set contains 1");
+ assertTrue(set2.contains(2), "set contains 2");
+ assertTrue(set2.contains(3), "set contains 3");
final Set<String> set3 = SetUtils.hashSet("1", "2", "2", "3");
- assertEquals("set has 3 elements", 3, set3.size());
- assertTrue("set contains 1", set3.contains("1"));
- assertTrue("set contains 2", set3.contains("2"));
- assertTrue("set contains 3", set3.contains("3"));
+ assertEquals(3, set3.size(), "set has 3 elements");
+ assertTrue(set3.contains("1"), "set contains 1");
+ assertTrue(set3.contains("2"), "set contains 2");
+ assertTrue(set3.contains("3"), "set contains 3");
final Set<?> set4 = SetUtils.hashSet(null, null);
- assertEquals("set has 1 element", 1, set4.size());
- assertTrue("set contains null", set4.contains(null));
+ assertEquals(1, set4.size(), "set has 1 element");
+ assertTrue(set4.contains(null), "set contains null");
final Set<?> set5 = SetUtils.hashSet((Object[]) null);
- assertNull("set is null", set5);
+ assertNull(set5, "set is null");
}
@Test
@@ -234,7 +234,7 @@ public class SetUtilsTest {
public void testpredicatedSet() {
final Predicate<Object> predicate = o -> o instanceof String;
final Set<Object> set = SetUtils.predicatedSet(new HashSet<>(),
predicate);
- assertTrue("returned object should be a PredicatedSet", set instanceof
PredicatedSet);
+ assertTrue(set instanceof PredicatedSet, "returned object should be a
PredicatedSet");
try {
SetUtils.predicatedSet(new HashSet<>(), null);
fail("Expecting NullPointerException for null predicate.");
@@ -252,26 +252,26 @@ public class SetUtilsTest {
@Test
public void testUnmodifiableSet() {
final Set<?> set1 = SetUtils.unmodifiableSet();
- assertTrue("set is empty", set1.isEmpty());
+ assertTrue(set1.isEmpty(), "set is empty");
final Set<Integer> set2 = SetUtils.unmodifiableSet(1, 2, 2, 3);
- assertEquals("set has 3 elements", 3, set2.size());
- assertTrue("set contains 1", set2.contains(1));
- assertTrue("set contains 2", set2.contains(2));
- assertTrue("set contains 3", set2.contains(3));
+ assertEquals(3, set2.size(), "set has 3 elements");
+ assertTrue(set2.contains(1), "set contains 1");
+ assertTrue(set2.contains(2), "set contains 2");
+ assertTrue(set2.contains(3), "set contains 3");
final Set<String> set3 = SetUtils.unmodifiableSet("1", "2", "2", "3");
- assertEquals("set has 3 elements", 3, set3.size());
- assertTrue("set contains 1", set3.contains("1"));
- assertTrue("set contains 2", set3.contains("2"));
- assertTrue("set contains 3", set3.contains("3"));
+ assertEquals(3, set3.size(), "set has 3 elements");
+ assertTrue(set3.contains("1"), "set contains 1");
+ assertTrue(set3.contains("2"), "set contains 2");
+ assertTrue(set3.contains("3"), "set contains 3");
final Set<?> set4 = SetUtils.unmodifiableSet(null, null);
- assertEquals("set has 1 element", 1, set4.size());
- assertTrue("set contains null", set4.contains(null));
+ assertEquals(1, set4.size(), "set has 1 element");
+ assertTrue(set4.contains(null), "set contains null");
final Set<?> set5 = SetUtils.unmodifiableSet((Object[]) null);
- assertNull("set is null", set5);
+ assertNull(set5, "set is null");
}
@Test
diff --git
a/src/test/java/org/apache/commons/collections4/SplitMapUtilsTest.java
b/src/test/java/org/apache/commons/collections4/SplitMapUtilsTest.java
index 2359be0..0ace69d 100644
--- a/src/test/java/org/apache/commons/collections4/SplitMapUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/SplitMapUtilsTest.java
@@ -16,11 +16,11 @@
*/
package org.apache.commons.collections4;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.util.HashMap;
import java.util.Map;
@@ -28,8 +28,8 @@ import java.util.Map;
import org.apache.commons.collections4.functors.NOPTransformer;
import org.apache.commons.collections4.map.HashedMap;
import org.apache.commons.collections4.splitmap.TransformedSplitMap;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Tests for {@link TransformedSplitMap}
@@ -43,7 +43,7 @@ public class SplitMapUtilsTest {
private final Transformer<String, Integer> stringToInt = Integer::valueOf;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
backingMap = new HashMap<>();
transformedMap = TransformedSplitMap.transformingMap(backingMap,
NOPTransformer.<String>nopTransformer(),
diff --git a/src/test/java/org/apache/commons/collections4/TestUtils.java
b/src/test/java/org/apache/commons/collections4/TestUtils.java
index da92660..aea4e24 100644
--- a/src/test/java/org/apache/commons/collections4/TestUtils.java
+++ b/src/test/java/org/apache/commons/collections4/TestUtils.java
@@ -16,7 +16,7 @@
*/
package org.apache.commons.collections4;
-import static org.junit.Assert.assertSame;
+import static org.junit.jupiter.api.Assertions.assertSame;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -57,7 +57,7 @@ public final class TestUtils {
ois.close();
// assert that original object and deserialized objects are the
same
- assertSame(msg, o, object);
+ assertSame(o, object, msg);
} catch (final IOException | ClassNotFoundException e) {
// should never happen
throw new RuntimeException(e);
diff --git
a/src/test/java/org/apache/commons/collections4/TransformerUtilsTest.java
b/src/test/java/org/apache/commons/collections4/TransformerUtilsTest.java
index 1c21fdd..5ab67c3 100644
--- a/src/test/java/org/apache/commons/collections4/TransformerUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/TransformerUtilsTest.java
@@ -16,11 +16,11 @@
*/
package org.apache.commons.collections4;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.fail;
import java.util.ArrayList;
import java.util.Collection;
@@ -37,7 +37,7 @@ import
org.apache.commons.collections4.functors.FalsePredicate;
import org.apache.commons.collections4.functors.NOPTransformer;
import org.apache.commons.collections4.functors.StringValueTransformer;
import org.apache.commons.collections4.functors.TruePredicate;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Tests the TransformerUtils class.
@@ -436,10 +436,10 @@ public class TransformerUtilsTest {
public void testStringValueTransformer() {
assertNotNull( "StringValueTransformer should NEVER return a null
value.",
TransformerUtils.stringValueTransformer().transform(null));
- assertEquals( "StringValueTransformer should return \"null\" when
given a null argument.", "null",
- TransformerUtils.stringValueTransformer().transform(null));
- assertEquals( "StringValueTransformer should return toString value",
"6",
- TransformerUtils.stringValueTransformer().transform(6));
+ assertEquals( "null",
+ TransformerUtils.stringValueTransformer().transform(null),
"StringValueTransformer should return \"null\" when given a null argument.");
+ assertEquals( "6",
+ TransformerUtils.stringValueTransformer().transform(6),
"StringValueTransformer should return toString value");
}
// instantiateFactory
diff --git a/src/test/java/org/apache/commons/collections4/TrieUtilsTest.java
b/src/test/java/org/apache/commons/collections4/TrieUtilsTest.java
index 1c78852..1dfab71 100644
--- a/src/test/java/org/apache/commons/collections4/TrieUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/TrieUtilsTest.java
@@ -16,11 +16,11 @@
*/
package org.apache.commons.collections4;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
import org.apache.commons.collections4.trie.PatriciaTrie;
import org.apache.commons.collections4.trie.UnmodifiableTrie;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Tests for TrieUtils factory methods.
@@ -33,8 +33,7 @@ public class TrieUtilsTest {
@Test
public void testUnmodifiableTrie() {
final Trie<String, Object> trie = TrieUtils.unmodifiableTrie(new
PatriciaTrie<>());
- assertTrue("Returned object should be an UnmodifiableTrie.",
- trie instanceof UnmodifiableTrie);
+ assertTrue(trie instanceof UnmodifiableTrie, "Returned object should
be an UnmodifiableTrie.");
try {
TrieUtils.unmodifiableTrie(null);
fail("Expecting NullPointerException for null trie.");
@@ -42,7 +41,7 @@ public class TrieUtilsTest {
// expected
}
- assertSame("UnmodifiableTrie shall not be decorated", trie,
TrieUtils.unmodifiableTrie(trie));
+ assertSame(trie, TrieUtils.unmodifiableTrie(trie), "UnmodifiableTrie
shall not be decorated");
}
}
diff --git
a/src/test/java/org/apache/commons/collections4/bag/AbstractBagTest.java
b/src/test/java/org/apache/commons/collections4/bag/AbstractBagTest.java
index c8e6962..6ebf38f 100644
--- a/src/test/java/org/apache/commons/collections4/bag/AbstractBagTest.java
+++ b/src/test/java/org/apache/commons/collections4/bag/AbstractBagTest.java
@@ -33,7 +33,7 @@ import org.apache.commons.collections4.BulkTest;
import org.apache.commons.collections4.collection.AbstractCollectionTest;
import org.apache.commons.collections4.set.AbstractSetTest;
-import static org.junit.Assert.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
/**
* Abstract test class for {@link org.apache.commons.collections4.Bag Bag}
methods and contracts.
diff --git
a/src/test/java/org/apache/commons/collections4/bloomfilter/AbstractBloomFilterTest.java
b/src/test/java/org/apache/commons/collections4/bloomfilter/AbstractBloomFilterTest.java
index baaec37..2a1faa1 100644
---
a/src/test/java/org/apache/commons/collections4/bloomfilter/AbstractBloomFilterTest.java
+++
b/src/test/java/org/apache/commons/collections4/bloomfilter/AbstractBloomFilterTest.java
@@ -16,10 +16,10 @@
*/
package org.apache.commons.collections4.bloomfilter;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.util.List;
import java.util.PrimitiveIterator.OfInt;
@@ -33,7 +33,7 @@ import
org.apache.commons.collections4.bloomfilter.hasher.HashFunctionIdentity;
import org.apache.commons.collections4.bloomfilter.hasher.Hasher;
import org.apache.commons.collections4.bloomfilter.hasher.Shape;
import org.apache.commons.collections4.bloomfilter.hasher.StaticHasher;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Test standard methods in the {@link BloomFilter} interface.
@@ -207,10 +207,10 @@ public abstract class AbstractBloomFilterTest {
final OfInt iter2 = hasher2.iterator(shape);
while (iter1.hasNext()) {
- assertTrue("Not enough data in second hasher", iter2.hasNext());
+ assertTrue(iter2.hasNext(), "Not enough data in second hasher");
assertEquals(iter1.nextInt(), iter2.nextInt());
}
- assertFalse("Too much data in second hasher", iter2.hasNext());
+ assertFalse(iter2.hasNext(), "Too much data in second hasher");
}
/**
@@ -466,7 +466,7 @@ public abstract class AbstractBloomFilterTest {
final BloomFilter bf2 = filterFactory.apply(hasher2, shape);
- assertTrue("Merge should not fail", bf.merge(bf2));
+ assertTrue(bf.merge(bf2), "Merge should not fail");
assertEquals(27, bf.cardinality());
}
@@ -506,7 +506,7 @@ public abstract class AbstractBloomFilterTest {
final List<Integer> lst2 = Arrays.asList(11, 12, 13, 14, 15, 16, 17,
18, 19, 20, 21, 22, 23, 24, 25, 26, 27);
final Hasher hasher2 = new StaticHasher(lst2.iterator(), shape);
- assertTrue("Merge should not fail", bf.merge(hasher2));
+ assertTrue(bf.merge(hasher2), "Merge should not fail");
assertEquals(27, bf.cardinality());
}
diff --git
a/src/test/java/org/apache/commons/collections4/bloomfilter/ArrayCountingBloomFilterTest.java
b/src/test/java/org/apache/commons/collections4/bloomfilter/ArrayCountingBloomFilterTest.java
index 50a20af..a661f93 100644
---
a/src/test/java/org/apache/commons/collections4/bloomfilter/ArrayCountingBloomFilterTest.java
+++
b/src/test/java/org/apache/commons/collections4/bloomfilter/ArrayCountingBloomFilterTest.java
@@ -16,9 +16,9 @@
*/
package org.apache.commons.collections4.bloomfilter;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Arrays;
import java.util.HashMap;
@@ -30,7 +30,7 @@ import java.util.function.ToIntBiFunction;
import org.apache.commons.collections4.bloomfilter.hasher.Hasher;
import org.apache.commons.collections4.bloomfilter.hasher.Shape;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Tests for the {@link ArrayCountingBloomFilter}.
@@ -86,10 +86,10 @@ public class ArrayCountingBloomFilterTest extends
AbstractBloomFilterTest {
int zeros = 0;
for (int i = 0; i < expected.length; i++) {
if (m.get(i) == null) {
- assertEquals("Wrong value for " + i, expected[i], 0);
+ assertEquals(expected[i], 0, "Wrong value for " + i);
zeros++;
} else {
- assertEquals("Wrong value for " + i, expected[i],
m.get(i).intValue());
+ assertEquals(expected[i], m.get(i).intValue(), "Wrong value
for " + i);
}
}
assertEquals(expected.length - zeros, bf.cardinality());
@@ -299,7 +299,7 @@ public class ArrayCountingBloomFilterTest extends
AbstractBloomFilterTest {
// Big + 1 = Overflow
assertTrue(bf2.isValid());
assertFalse(bf2.merge(bf));
- assertFalse("Merge should overflow and the filter is invalid",
bf2.isValid());
+ assertFalse(bf2.isValid(), "Merge should overflow and the filter is
invalid");
// The counts are not clipped to max. They have simply overflowed.
// Note that this is a merge and the count is only incremented by 1
@@ -326,7 +326,7 @@ public class ArrayCountingBloomFilterTest extends
AbstractBloomFilterTest {
// Less - More = Negative
assertTrue(bf2.isValid());
bf2.remove(bf);
- assertFalse("Remove should create negative counts and the filter is
invalid", bf2.isValid());
+ assertFalse(bf2.isValid(), "Remove should create negative counts and
the filter is invalid");
// The counts are not clipped to zero. They have been left as negative.
assertCounts(bf2, new int[] {0, -1, 1, -1});
diff --git
a/src/test/java/org/apache/commons/collections4/bloomfilter/BloomFilterIndexerTest.java
b/src/test/java/org/apache/commons/collections4/bloomfilter/BloomFilterIndexerTest.java
index e0fd5f4..ffd2d0d 100644
---
a/src/test/java/org/apache/commons/collections4/bloomfilter/BloomFilterIndexerTest.java
+++
b/src/test/java/org/apache/commons/collections4/bloomfilter/BloomFilterIndexerTest.java
@@ -16,8 +16,9 @@
*/
package org.apache.commons.collections4.bloomfilter;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList;
import java.util.Random;
@@ -37,33 +38,33 @@ public class BloomFilterIndexerTest {
@Test
public void testGetLongIndex() {
- Assert.assertEquals(0, BloomFilterIndexer.getLongIndex(0));
+ assertEquals(0, BloomFilterIndexer.getLongIndex(0));
for (final int index : getIndexes()) {
// getLongIndex is expected to identify a block of 64-bits
(starting from zero)
- Assert.assertEquals(index / Long.SIZE,
BloomFilterIndexer.getLongIndex(index));
+ assertEquals(index / Long.SIZE,
BloomFilterIndexer.getLongIndex(index));
// Verify the behavior for negatives. It should produce a negative
(invalid)
// as a simple trip for incorrect usage.
- Assert.assertTrue(BloomFilterIndexer.getLongIndex(-index) < 0);
+ assertTrue(BloomFilterIndexer.getLongIndex(-index) < 0);
// If index is not zero then when negated this is what a signed
shift
// of 6-bits actually does
- Assert.assertEquals(((1 - index) / Long.SIZE) - 1,
+ assertEquals(((1 - index) / Long.SIZE) - 1,
BloomFilterIndexer.getLongIndex(-index));
}
}
@Test
public void testGetLongBit() {
- Assert.assertEquals(1L, BloomFilterIndexer.getLongBit(0));
+ assertEquals(1L, BloomFilterIndexer.getLongBit(0));
for (final int index : getIndexes()) {
// getLongBit is expected to identify a single bit in a 64-bit
block
- Assert.assertEquals(1L << (index % Long.SIZE),
BloomFilterIndexer.getLongBit(index));
+ assertEquals(1L << (index % Long.SIZE),
BloomFilterIndexer.getLongBit(index));
// Verify the behavior for negatives
- Assert.assertEquals(1L << (64 - (index & 0x3f)),
BloomFilterIndexer.getLongBit(-index));
+ assertEquals(1L << (64 - (index & 0x3f)),
BloomFilterIndexer.getLongBit(-index));
}
}
diff --git
a/src/test/java/org/apache/commons/collections4/bloomfilter/HasherBloomFilterTest.java
b/src/test/java/org/apache/commons/collections4/bloomfilter/HasherBloomFilterTest.java
index ddb8752..a10df81 100644
---
a/src/test/java/org/apache/commons/collections4/bloomfilter/HasherBloomFilterTest.java
+++
b/src/test/java/org/apache/commons/collections4/bloomfilter/HasherBloomFilterTest.java
@@ -16,15 +16,15 @@
*/
package org.apache.commons.collections4.bloomfilter;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.apache.commons.collections4.bloomfilter.hasher.DynamicHasher;
import org.apache.commons.collections4.bloomfilter.hasher.HashFunctionIdentity;
import org.apache.commons.collections4.bloomfilter.hasher.Hasher;
import org.apache.commons.collections4.bloomfilter.hasher.Shape;
import org.apache.commons.collections4.bloomfilter.hasher.function.MD5Cyclic;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.PrimitiveIterator.OfInt;
@@ -65,7 +65,7 @@ public class HasherBloomFilterTest extends
AbstractBloomFilterTest {
@Test
public void getBitsTest_Empty() {
final BloomFilter filter = createEmptyFilter(shape);
- Assert.assertArrayEquals(new long[0], filter.getBits());
+ assertArrayEquals(new long[0], filter.getBits());
}
/**
@@ -87,6 +87,6 @@ public class HasherBloomFilterTest extends
AbstractBloomFilterTest {
return shape.getHashFunctionIdentity();
}
});
- Assert.assertArrayEquals(new long[] {1L}, filter.getBits());
+ assertArrayEquals(new long[] {1L}, filter.getBits());
}
}
diff --git
a/src/test/java/org/apache/commons/collections4/bloomfilter/IndexFilterTest.java
b/src/test/java/org/apache/commons/collections4/bloomfilter/IndexFilterTest.java
index 30fc11e..c6c6a03 100644
---
a/src/test/java/org/apache/commons/collections4/bloomfilter/IndexFilterTest.java
+++
b/src/test/java/org/apache/commons/collections4/bloomfilter/IndexFilterTest.java
@@ -20,8 +20,7 @@ import
org.apache.commons.collections4.bloomfilter.hasher.HashFunctionIdentityIm
import org.apache.commons.collections4.bloomfilter.hasher.Shape;
import
org.apache.commons.collections4.bloomfilter.hasher.HashFunctionIdentity.ProcessType;
import
org.apache.commons.collections4.bloomfilter.hasher.HashFunctionIdentity.Signedness;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.Arrays;
@@ -29,6 +28,10 @@ import java.util.Set;
import java.util.function.IntConsumer;
import java.util.stream.Collectors;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
/**
* Tests for the {@link IndexFilters}.
*/
@@ -52,21 +55,21 @@ public class IndexFilterTest {
try {
IndexFilters.distinctIndexes(null, shape, consumer);
- Assert.fail("null hasher");
+ fail("null hasher");
} catch (final NullPointerException expected) {
// Ignore
}
try {
IndexFilters.distinctIndexes(hasher, null, consumer);
- Assert.fail("null shape");
+ fail("null shape");
} catch (final NullPointerException expected) {
// Ignore
}
try {
IndexFilters.distinctIndexes(hasher, shape, null);
- Assert.fail("null consumer");
+ fail("null consumer");
} catch (final NullPointerException expected) {
// Ignore
}
@@ -92,12 +95,12 @@ public class IndexFilterTest {
IndexFilters.distinctIndexes(hasher, shape, actual::add);
- Assert.assertEquals(expected.size(), actual.size());
+ assertEquals(expected.size(), actual.size());
// Check the array has all the values.
// We do not currently check the order of indexes from the
// hasher.iterator() function.
for (final Integer index : actual) {
- Assert.assertTrue(expected.contains(index));
+ assertTrue(expected.contains(index));
}
}
}
diff --git
a/src/test/java/org/apache/commons/collections4/bloomfilter/SetOperationsTest.java
b/src/test/java/org/apache/commons/collections4/bloomfilter/SetOperationsTest.java
index f06974f..5414289 100644
---
a/src/test/java/org/apache/commons/collections4/bloomfilter/SetOperationsTest.java
+++
b/src/test/java/org/apache/commons/collections4/bloomfilter/SetOperationsTest.java
@@ -16,15 +16,16 @@
*/
package org.apache.commons.collections4.bloomfilter;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
+
import java.util.List;
import java.util.Arrays;
import org.apache.commons.collections4.bloomfilter.hasher.HashFunctionIdentity;
import org.apache.commons.collections4.bloomfilter.hasher.Hasher;
import org.apache.commons.collections4.bloomfilter.hasher.Shape;
import org.apache.commons.collections4.bloomfilter.hasher.StaticHasher;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Test {@link SetOperations}.
@@ -74,7 +75,7 @@ public class SetOperationsTest {
try {
SetOperations.cosineDistance(filter1, filter2);
- Assert.fail("Expected an IllegalArgumentException");
+ fail("Expected an IllegalArgumentException");
} catch (final IllegalArgumentException expected) {
// Ignore
}
diff --git
a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/DynamicHasherBuilderTest.java
b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/DynamicHasherBuilderTest.java
index 49b4057..afbd6d8 100644
---
a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/DynamicHasherBuilderTest.java
+++
b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/DynamicHasherBuilderTest.java
@@ -16,18 +16,18 @@
*/
package org.apache.commons.collections4.bloomfilter.hasher;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.nio.charset.StandardCharsets;
import java.util.NoSuchElementException;
import java.util.PrimitiveIterator.OfInt;
import org.apache.commons.collections4.bloomfilter.hasher.function.MD5Cyclic;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* {@link DynamicHasher.Builder} tests.
@@ -125,7 +125,7 @@ public class DynamicHasherBuilderTest {
/**
* Sets up the builder for testing.
*/
- @Before
+ @BeforeEach
public void setup() {
builder = new DynamicHasher.Builder(hf);
}
diff --git
a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/DynamicHasherTest.java
b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/DynamicHasherTest.java
index 317bf95..7b2bbba 100644
---
a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/DynamicHasherTest.java
+++
b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/DynamicHasherTest.java
@@ -16,18 +16,19 @@
*/
package org.apache.commons.collections4.bloomfilter.hasher;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.nio.charset.StandardCharsets;
import java.util.NoSuchElementException;
import java.util.PrimitiveIterator.OfInt;
import org.apache.commons.collections4.bloomfilter.hasher.function.MD5Cyclic;
-import org.junit.Before;
-import org.junit.Test;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Tests the {@link DynamicHasher}.
@@ -67,7 +68,7 @@ public class DynamicHasherTest {
/**
* Sets up the DynamicHasher.
*/
- @Before
+ @BeforeEach
public void setup() {
builder = new DynamicHasher.Builder(new MD5Cyclic());
shape = new Shape(new MD5Cyclic(), 3, 72, 17);
diff --git
a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/HashFunctionIdentityImplTest.java
b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/HashFunctionIdentityImplTest.java
index 3a125bd..479cfa5 100644
---
a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/HashFunctionIdentityImplTest.java
+++
b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/HashFunctionIdentityImplTest.java
@@ -16,11 +16,11 @@
*/
package org.apache.commons.collections4.bloomfilter.hasher;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import
org.apache.commons.collections4.bloomfilter.hasher.HashFunctionIdentity.Signedness;
import
org.apache.commons.collections4.bloomfilter.hasher.HashFunctionIdentity.ProcessType;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Tests the HashFunctionIdentity implementation ({@link
HashFunctionIdentityImpl})..
diff --git
a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/HashFunctionValidatorTest.java
b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/HashFunctionValidatorTest.java
index bd9532a..e68df55 100644
---
a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/HashFunctionValidatorTest.java
+++
b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/HashFunctionValidatorTest.java
@@ -16,9 +16,9 @@
*/
package org.apache.commons.collections4.bloomfilter.hasher;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import
org.apache.commons.collections4.bloomfilter.hasher.HashFunctionIdentity.ProcessType;
import
org.apache.commons.collections4.bloomfilter.hasher.HashFunctionIdentity.Signedness;
diff --git
a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/HasherBuilderTest.java
b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/HasherBuilderTest.java
index 1231aa3..3030340 100644
---
a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/HasherBuilderTest.java
+++
b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/HasherBuilderTest.java
@@ -18,8 +18,7 @@ package org.apache.commons.collections4.bloomfilter.hasher;
import org.apache.commons.collections4.bloomfilter.hasher.Hasher.Builder;
import org.apache.commons.lang3.NotImplementedException;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.CharBuffer;
@@ -27,6 +26,9 @@ import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
/**
* Tests the
* {@link org.apache.commons.collections4.bloomfilter.hasher.Hasher.Builder
Hasher.Builder}.
@@ -64,7 +66,7 @@ public class HasherBuilderTest {
}) {
final TestBuilder builder = new TestBuilder();
builder.with(s, cs);
- Assert.assertArrayEquals(s.getBytes(cs), builder.items.get(0));
+ assertArrayEquals(s.getBytes(cs), builder.items.get(0));
}
}
}
@@ -82,12 +84,12 @@ public class HasherBuilderTest {
final byte[] encoded = builder.items.get(0);
final char[] original = s.toCharArray();
// Should be twice the length
- Assert.assertEquals(original.length * 2, encoded.length);
+ assertEquals(original.length * 2, encoded.length);
// Should be little endian (lower bits first)
final CharBuffer buffer = ByteBuffer.wrap(encoded)
.order(ByteOrder.LITTLE_ENDIAN).asCharBuffer();
for (int i = 0; i < original.length; i++) {
- Assert.assertEquals(original[i], buffer.get(i));
+ assertEquals(original[i], buffer.get(i));
}
}
}
diff --git
a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/ShapeTest.java
b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/ShapeTest.java
index 35edb1a..90f3808 100644
---
a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/ShapeTest.java
+++
b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/ShapeTest.java
@@ -16,16 +16,16 @@
*/
package org.apache.commons.collections4.bloomfilter.hasher;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.fail;
import
org.apache.commons.collections4.bloomfilter.hasher.HashFunctionIdentity.ProcessType;
import
org.apache.commons.collections4.bloomfilter.hasher.HashFunctionIdentity.Signedness;
import java.util.ArrayList;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Tests the {@link Shape} class.
diff --git
a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/StaticHasherTest.java
b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/StaticHasherTest.java
index f2718cf..c3d7c5c 100644
---
a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/StaticHasherTest.java
+++
b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/StaticHasherTest.java
@@ -16,17 +16,17 @@
*/
package org.apache.commons.collections4.bloomfilter.hasher;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.PrimitiveIterator.OfInt;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Tests the {@link StaticHasher}.
@@ -102,10 +102,10 @@ public class StaticHasherTest {
final OfInt iter2 = hasher2.iterator(shape);
while (iter1.hasNext()) {
- assertTrue("Not enough data in second hasher", iter2.hasNext());
+ assertTrue(iter2.hasNext(), "Not enough data in second hasher");
assertEquals(iter1.nextInt(), iter2.nextInt());
}
- assertFalse("Too much data in second hasher", iter2.hasNext());
+ assertFalse(iter2.hasNext(), "Too much data in second hasher");
}
/**
@@ -188,7 +188,7 @@ public class StaticHasherTest {
iter = hasher.iterator(shape);
int idx = 0;
while (iter.hasNext()) {
- assertEquals("Error at idx " + idx, Integer.valueOf(values[idx]),
iter.next());
+ assertEquals(Integer.valueOf(values[idx]), iter.next(), "Error at
idx " + idx);
idx++;
}
assertEquals(5, idx);
diff --git
a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/AbstractHashFunctionTest.java
b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/AbstractHashFunctionTest.java
index 740de16..5498d69 100644
---
a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/AbstractHashFunctionTest.java
+++
b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/AbstractHashFunctionTest.java
@@ -16,11 +16,11 @@
*/
package org.apache.commons.collections4.bloomfilter.hasher.function;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.apache.commons.collections4.bloomfilter.hasher.HashFunction;
import org.apache.commons.collections4.bloomfilter.hasher.HashFunctionIdentity;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Tests the signature of a hash function.
diff --git
a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/MD5CyclicTest.java
b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/MD5CyclicTest.java
index a0d837f..9b0d9a8 100644
---
a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/MD5CyclicTest.java
+++
b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/MD5CyclicTest.java
@@ -16,10 +16,10 @@
*/
package org.apache.commons.collections4.bloomfilter.hasher.function;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.apache.commons.collections4.bloomfilter.hasher.HashFunction;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Tests the MD5 cyclic hash function.
diff --git
a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/Murmur128x64CyclicTest.java
b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/Murmur128x64CyclicTest.java
index d576931..9e17c2e 100644
---
a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/Murmur128x64CyclicTest.java
+++
b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/Murmur128x64CyclicTest.java
@@ -16,11 +16,11 @@
*/
package org.apache.commons.collections4.bloomfilter.hasher.function;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.nio.charset.StandardCharsets;
import org.apache.commons.collections4.bloomfilter.hasher.HashFunction;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Test that the Murmur3 128 x64 hash function works correctly.
diff --git
a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/Murmur32x86IterativeTest.java
b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/Murmur32x86IterativeTest.java
index ac2e462..bca60c1 100644
---
a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/Murmur32x86IterativeTest.java
+++
b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/Murmur32x86IterativeTest.java
@@ -16,11 +16,11 @@
*/
package org.apache.commons.collections4.bloomfilter.hasher.function;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.nio.charset.StandardCharsets;
import org.apache.commons.collections4.bloomfilter.hasher.HashFunction;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Test that the Murmur3 32 x86 hash function works correctly.
diff --git
a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/ObjectsHashIterativeTest.java
b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/ObjectsHashIterativeTest.java
index cc01339..5595efd 100644
---
a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/ObjectsHashIterativeTest.java
+++
b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/ObjectsHashIterativeTest.java
@@ -16,12 +16,12 @@
*/
package org.apache.commons.collections4.bloomfilter.hasher.function;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import org.apache.commons.collections4.bloomfilter.hasher.HashFunction;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Tests that the Objects hash works correctly.
diff --git
a/src/test/java/org/apache/commons/collections4/collection/PredicatedCollectionBuilderTest.java
b/src/test/java/org/apache/commons/collections4/collection/PredicatedCollectionBuilderTest.java
index 37334a2..82802f6 100644
---
a/src/test/java/org/apache/commons/collections4/collection/PredicatedCollectionBuilderTest.java
+++
b/src/test/java/org/apache/commons/collections4/collection/PredicatedCollectionBuilderTest.java
@@ -24,8 +24,11 @@ import java.util.Set;
import org.apache.commons.collections4.Bag;
import org.apache.commons.collections4.Predicate;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Tests the PredicatedCollection.Builder class.
@@ -41,7 +44,7 @@ public class PredicatedCollectionBuilderTest {
public void addPass() {
final PredicatedCollection.Builder<String> builder =
PredicatedCollection.notNullBuilder();
builder.add("test");
- Assert.assertEquals(builder.createPredicatedList().size(), 1);
+ assertEquals(builder.createPredicatedList().size(), 1);
}
/**
@@ -51,9 +54,9 @@ public class PredicatedCollectionBuilderTest {
public void addFail() {
final PredicatedCollection.Builder<String> builder =
PredicatedCollection.notNullBuilder();
builder.add((String) null);
- Assert.assertTrue(builder.createPredicatedList().isEmpty());
+ assertTrue(builder.createPredicatedList().isEmpty());
- Assert.assertEquals(1, builder.rejectedElements().size());
+ assertEquals(1, builder.rejectedElements().size());
}
/**
@@ -63,7 +66,7 @@ public class PredicatedCollectionBuilderTest {
public void addAllPass() {
final PredicatedCollection.Builder<String> builder =
PredicatedCollection.notNullBuilder();
builder.addAll(Arrays.asList("test1", null, "test2"));
- Assert.assertEquals(builder.createPredicatedList().size(), 2);
+ assertEquals(builder.createPredicatedList().size(), 2);
}
@Test
@@ -86,17 +89,13 @@ public class PredicatedCollectionBuilderTest {
}
private void checkPredicatedCollection1(final Collection<String>
collection) {
- Assert.assertEquals(1, collection.size());
+ assertEquals(1, collection.size());
collection.add("test2");
- Assert.assertEquals(2, collection.size());
+ assertEquals(2, collection.size());
+
+ assertThrows(IllegalArgumentException.class, () ->
collection.add(null), "Expecting IllegalArgumentException for failing
predicate!");
- try {
- collection.add(null);
- Assert.fail("Expecting IllegalArgumentException for failing
predicate!");
- } catch (final IllegalArgumentException iae) {
- // expected
- }
}
@Test
@@ -122,17 +121,12 @@ public class PredicatedCollectionBuilderTest {
}
private void checkPredicatedCollection2(final Collection<Integer>
collection) {
- Assert.assertEquals(2, collection.size());
-
- try {
- collection.add(4);
- Assert.fail("Expecting IllegalArgumentException for failing
predicate!");
- } catch (final IllegalArgumentException iae) {
- }
- Assert.assertEquals(2, collection.size());
+ assertEquals(2, collection.size());
+ assertThrows(IllegalArgumentException.class, () -> collection.add(4),
"Expecting IllegalArgumentException for failing predicate!");
+ assertEquals(2, collection.size());
collection.add(5);
- Assert.assertEquals(3, collection.size());
+ assertEquals(3, collection.size());
}
private static class OddPredicate implements Predicate<Integer> {
diff --git
a/src/test/java/org/apache/commons/collections4/comparators/BooleanComparatorTest.java
b/src/test/java/org/apache/commons/collections4/comparators/BooleanComparatorTest.java
index 41067b9..387b514 100644
---
a/src/test/java/org/apache/commons/collections4/comparators/BooleanComparatorTest.java
+++
b/src/test/java/org/apache/commons/collections4/comparators/BooleanComparatorTest.java
@@ -23,7 +23,7 @@ import java.util.List;
import org.junit.Test;
-import static org.junit.Assert.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
/**
* Tests for {@link BooleanComparator}.
diff --git
a/src/test/java/org/apache/commons/collections4/functors/AbstractAnyAllOnePredicateTest.java
b/src/test/java/org/apache/commons/collections4/functors/AbstractAnyAllOnePredicateTest.java
index 3f0d845..ea48d85 100644
---
a/src/test/java/org/apache/commons/collections4/functors/AbstractAnyAllOnePredicateTest.java
+++
b/src/test/java/org/apache/commons/collections4/functors/AbstractAnyAllOnePredicateTest.java
@@ -18,10 +18,10 @@ package org.apache.commons.collections4.functors;
import org.apache.commons.collections4.Predicate;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import org.junit.Test;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.Test;
import java.util.Collections;
@@ -50,7 +50,7 @@ public abstract class AbstractAnyAllOnePredicateTest<T>
extends AbstractComposit
public final void singleElementArrayToGetInstance() {
final Predicate<T> predicate = createMockPredicate(null);
final Predicate<T> allPredicate = getPredicateInstance(predicate);
- assertSame("expected argument to be returned by getInstance()",
predicate, allPredicate);
+ assertSame(predicate, allPredicate, "expected argument to be returned
by getInstance()");
}
/**
@@ -63,8 +63,7 @@ public abstract class AbstractAnyAllOnePredicateTest<T>
extends AbstractComposit
final Predicate<T> predicate = createMockPredicate(null);
final Predicate<T> allPredicate = getPredicateInstance(
Collections.<Predicate<T>>singleton(predicate));
- assertSame("expected singleton collection member to be returned by
getInstance()",
- predicate, allPredicate);
+ assertSame(predicate, allPredicate, "expected singleton collection
member to be returned by getInstance()");
}
/**
diff --git
a/src/test/java/org/apache/commons/collections4/functors/AbstractClosureTest.java
b/src/test/java/org/apache/commons/collections4/functors/AbstractClosureTest.java
index d540127..3a27c17 100644
---
a/src/test/java/org/apache/commons/collections4/functors/AbstractClosureTest.java
+++
b/src/test/java/org/apache/commons/collections4/functors/AbstractClosureTest.java
@@ -17,15 +17,16 @@
package org.apache.commons.collections4.functors;
import org.apache.commons.collections4.Closure;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
public abstract class AbstractClosureTest {
@Test
public void closureSanityTests() throws Exception {
final Closure<?> closure = generateClosure();
- Assert.assertNotNull(closure);
+ assertNotNull(closure);
}
/**
diff --git
a/src/test/java/org/apache/commons/collections4/functors/AbstractMockPredicateTest.java
b/src/test/java/org/apache/commons/collections4/functors/AbstractMockPredicateTest.java
index daf4c95..0774619 100644
---
a/src/test/java/org/apache/commons/collections4/functors/AbstractMockPredicateTest.java
+++
b/src/test/java/org/apache/commons/collections4/functors/AbstractMockPredicateTest.java
@@ -21,8 +21,8 @@ import java.util.List;
import static org.easymock.EasyMock.verify;
import static org.easymock.EasyMock.replay;
-import org.junit.Before;
-import org.junit.After;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.AfterEach;
import org.apache.commons.collections4.Predicate;
import org.easymock.EasyMock;
@@ -55,7 +55,7 @@ public abstract class AbstractMockPredicateTest<T> {
/**
* Creates the list of predicates to verify.
*/
- @Before
+ @BeforeEach
public final void createVerifyList() {
mockPredicatesToVerify = new ArrayList<>();
}
@@ -63,7 +63,7 @@ public abstract class AbstractMockPredicateTest<T> {
/**
* Verifies all the mock predicates created for the test.
*/
- @After
+ @AfterEach
public final void verifyPredicates() {
for (final Predicate<? super T> predicate : mockPredicatesToVerify) {
verify(predicate);
diff --git
a/src/test/java/org/apache/commons/collections4/functors/AllPredicateTest.java
b/src/test/java/org/apache/commons/collections4/functors/AllPredicateTest.java
index 56584d8..d0d8dce 100644
---
a/src/test/java/org/apache/commons/collections4/functors/AllPredicateTest.java
+++
b/src/test/java/org/apache/commons/collections4/functors/AllPredicateTest.java
@@ -19,9 +19,9 @@ package org.apache.commons.collections4.functors;
import org.apache.commons.collections4.Predicate;
import static
org.apache.commons.collections4.functors.AllPredicate.allPredicate;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import org.junit.Test;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.Test;
import java.util.Collection;
import java.util.Collections;
@@ -63,7 +63,7 @@ public class AllPredicateTest extends
AbstractAnyAllOnePredicateTest<Integer> {
@SuppressWarnings({"unchecked"})
@Test
public void emptyArrayToGetInstance() {
- assertTrue("empty array not true", getPredicateInstance(new
Predicate[] {}).evaluate(null));
+ assertTrue(getPredicateInstance(new Predicate[] {}).evaluate(null),
"empty array not true");
}
/**
@@ -73,7 +73,7 @@ public class AllPredicateTest extends
AbstractAnyAllOnePredicateTest<Integer> {
public void emptyCollectionToGetInstance() {
final Predicate<Integer> allPredicate = getPredicateInstance(
Collections.<Predicate<Integer>>emptyList());
- assertTrue("empty collection not true",
allPredicate.evaluate(getTestValue()));
+ assertTrue(allPredicate.evaluate(getTestValue()), "empty collection
not true");
}
/**
@@ -86,8 +86,7 @@ public class AllPredicateTest extends
AbstractAnyAllOnePredicateTest<Integer> {
// an array of size one.
final Predicate<Integer> predicate = createMockPredicate(true);
- assertTrue("single true predicate evaluated to false",
- allPredicate(predicate).evaluate(getTestValue()));
+ assertTrue(allPredicate(predicate).evaluate(getTestValue()), "single
true predicate evaluated to false");
}
/**
@@ -99,8 +98,8 @@ public class AllPredicateTest extends
AbstractAnyAllOnePredicateTest<Integer> {
// use the constructor directly, as getInstance() returns the original
predicate when passed
// an array of size one.
final Predicate<Integer> predicate = createMockPredicate(false);
- assertFalse("single false predicate evaluated to true",
- allPredicate(predicate).evaluate(getTestValue()));
+ assertFalse(allPredicate(predicate).evaluate(getTestValue()),
+ "single false predicate evaluated to true");
}
/**
@@ -108,10 +107,10 @@ public class AllPredicateTest extends
AbstractAnyAllOnePredicateTest<Integer> {
*/
@Test
public void allTrue() {
- assertTrue("multiple true predicates evaluated to false",
- getPredicateInstance(true, true).evaluate(getTestValue()));
- assertTrue("multiple true predicates evaluated to false",
- getPredicateInstance(true, true,
true).evaluate(getTestValue()));
+ assertTrue(getPredicateInstance(true, true).evaluate(getTestValue()),
+ "multiple true predicates evaluated to false");
+ assertTrue(getPredicateInstance(true, true,
true).evaluate(getTestValue()),
+ "multiple true predicates evaluated to false");
}
/**
@@ -120,15 +119,15 @@ public class AllPredicateTest extends
AbstractAnyAllOnePredicateTest<Integer> {
*/
@Test
public void trueAndFalseCombined() {
- assertFalse("false predicate evaluated to true",
- getPredicateInstance(false, null).evaluate(getTestValue()));
- assertFalse("false predicate evaluated to true",
- getPredicateInstance(false, null,
null).evaluate(getTestValue()));
- assertFalse("false predicate evaluated to true",
- getPredicateInstance(true, false,
null).evaluate(getTestValue()));
- assertFalse("false predicate evaluated to true",
- getPredicateInstance(true, true,
false).evaluate(getTestValue()));
- assertFalse("false predicate evaluated to true",
- getPredicateInstance(true, true, false,
null).evaluate(getTestValue()));
+ assertFalse(getPredicateInstance(false, null).evaluate(getTestValue()),
+ "false predicate evaluated to true");
+ assertFalse(getPredicateInstance(false, null,
null).evaluate(getTestValue()),
+ "false predicate evaluated to true");
+ assertFalse(getPredicateInstance(true, false,
null).evaluate(getTestValue()),
+ "false predicate evaluated to true");
+ assertFalse(getPredicateInstance(true, true,
false).evaluate(getTestValue()),
+ "false predicate evaluated to true");
+ assertFalse(getPredicateInstance(true, true, false,
null).evaluate(getTestValue()),
+ "false predicate evaluated to true");
}
}
diff --git
a/src/test/java/org/apache/commons/collections4/functors/CatchAndRethrowClosureTest.java
b/src/test/java/org/apache/commons/collections4/functors/CatchAndRethrowClosureTest.java
index a3ea134..a251a93 100644
---
a/src/test/java/org/apache/commons/collections4/functors/CatchAndRethrowClosureTest.java
+++
b/src/test/java/org/apache/commons/collections4/functors/CatchAndRethrowClosureTest.java
@@ -20,8 +20,10 @@ import java.io.IOException;
import org.apache.commons.collections4.Closure;
import org.apache.commons.collections4.FunctorException;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
public class CatchAndRethrowClosureTest extends AbstractClosureTest {
@@ -65,27 +67,27 @@ public class CatchAndRethrowClosureTest extends
AbstractClosureTest {
try {
closure.execute(Integer.valueOf(0));
} catch (final RuntimeException ex) {
- Assert.fail();
+ fail();
}
closure = generateIOExceptionClosure();
try {
closure.execute(Integer.valueOf(0));
- Assert.fail();
+ fail();
} catch (final FunctorException ex) {
- Assert.assertTrue(ex.getCause() instanceof IOException);
+ assertTrue(ex.getCause() instanceof IOException);
} catch (final RuntimeException ex) {
- Assert.fail();
+ fail();
}
closure = generateNullPointerExceptionClosure();
try {
closure.execute(Integer.valueOf(0));
- Assert.fail();
+ fail();
} catch (final FunctorException ex) {
- Assert.fail();
+ fail();
} catch (final RuntimeException ex) {
- Assert.assertTrue(ex instanceof NullPointerException);
+ assertTrue(ex instanceof NullPointerException);
}
}
}
diff --git
a/src/test/java/org/apache/commons/collections4/functors/EqualPredicateTest.java
b/src/test/java/org/apache/commons/collections4/functors/EqualPredicateTest.java
index 3ff4861..1695ab5 100644
---
a/src/test/java/org/apache/commons/collections4/functors/EqualPredicateTest.java
+++
b/src/test/java/org/apache/commons/collections4/functors/EqualPredicateTest.java
@@ -18,10 +18,10 @@ package org.apache.commons.collections4.functors;
import static
org.apache.commons.collections4.functors.EqualPredicate.equalPredicate;
import static
org.apache.commons.collections4.functors.NullPredicate.nullPredicate;
-import static org.junit.Assert.assertSame;
+import static org.junit.jupiter.api.Assertions.assertSame;
import org.apache.commons.collections4.Predicate;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class EqualPredicateTest extends AbstractPredicateTest {
diff --git
a/src/test/java/org/apache/commons/collections4/functors/NullPredicateTest.java
b/src/test/java/org/apache/commons/collections4/functors/NullPredicateTest.java
index 15abe48..d41d8dc 100644
---
a/src/test/java/org/apache/commons/collections4/functors/NullPredicateTest.java
+++
b/src/test/java/org/apache/commons/collections4/functors/NullPredicateTest.java
@@ -17,7 +17,7 @@
package org.apache.commons.collections4.functors;
import static
org.apache.commons.collections4.functors.NullPredicate.nullPredicate;
-import static org.junit.Assert.assertSame;
+import static org.junit.jupiter.api.Assertions.assertSame;
import org.apache.commons.collections4.Predicate;
import org.junit.jupiter.api.Test;
diff --git
a/src/test/java/org/apache/commons/collections4/iterators/FilterListIteratorTest.java
b/src/test/java/org/apache/commons/collections4/iterators/FilterListIteratorTest.java
index 0507330..ac4e367 100644
---
a/src/test/java/org/apache/commons/collections4/iterators/FilterListIteratorTest.java
+++
b/src/test/java/org/apache/commons/collections4/iterators/FilterListIteratorTest.java
@@ -25,12 +25,11 @@ import java.util.Random;
import org.apache.commons.collections4.Predicate;
import org.apache.commons.collections4.PredicateUtils;
import org.apache.commons.collections4.list.GrowthList;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
/**
* Tests the FilterListIterator class.
@@ -53,7 +52,7 @@ public class FilterListIteratorTest {
private Predicate<Integer> fourPred = null;
private final Random random = new Random();
- @Before
+ @BeforeEach
public void setUp() {
list = new ArrayList<>();
odds = new ArrayList<>();
@@ -94,7 +93,7 @@ public class FilterListIteratorTest {
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
list = null;
odds = null;
@@ -289,9 +288,9 @@ public class FilterListIteratorTest {
final Collection<Predicate<Object>> var7 = new GrowthList<>();
final Predicate<Object> var9 = PredicateUtils.anyPredicate(var7);
final FilterListIterator<Object> var13 = new
FilterListIterator<>(var9);
- Assert.assertFalse(var13.hasNext());
+ assertFalse(var13.hasNext());
final FilterListIterator<Object> var14 = new
FilterListIterator<>(var9);
- Assert.assertFalse(var14.hasPrevious());
+ assertFalse(var14.hasPrevious());
}
// Utilities
@@ -409,17 +408,17 @@ public class FilterListIteratorTest {
// step forward
walkdescr.append("+");
if (expected.hasNext()) {
- assertEquals(walkdescr.toString(), expected.next(),
testing.next());
+ assertEquals(expected.next(), testing.next(),
walkdescr.toString());
}
} else {
// step backward
walkdescr.append("-");
if (expected.hasPrevious()) {
- assertEquals(walkdescr.toString(), expected.previous(),
testing.previous());
+ assertEquals(expected.previous(), testing.previous(),
walkdescr.toString());
}
}
- assertEquals(walkdescr.toString(), expected.nextIndex(),
testing.nextIndex());
- assertEquals(walkdescr.toString(), expected.previousIndex(),
testing.previousIndex());
+ assertEquals(expected.nextIndex(), testing.nextIndex(),
walkdescr.toString());
+ assertEquals(expected.previousIndex(), testing.previousIndex(),
walkdescr.toString());
}
}
diff --git
a/src/test/java/org/apache/commons/collections4/iterators/IteratorEnumerationTest.java
b/src/test/java/org/apache/commons/collections4/iterators/IteratorEnumerationTest.java
index 2c6c4f0..b656205 100644
---
a/src/test/java/org/apache/commons/collections4/iterators/IteratorEnumerationTest.java
+++
b/src/test/java/org/apache/commons/collections4/iterators/IteratorEnumerationTest.java
@@ -20,8 +20,8 @@ import java.util.Arrays;
import java.util.Iterator;
import java.util.NoSuchElementException;
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.*;
/**
* Tests the IteratorEnumeration.
diff --git
a/src/test/java/org/apache/commons/collections4/iterators/LoopingIteratorTest.java
b/src/test/java/org/apache/commons/collections4/iterators/LoopingIteratorTest.java
index 7d9b760..d3df80c 100644
---
a/src/test/java/org/apache/commons/collections4/iterators/LoopingIteratorTest.java
+++
b/src/test/java/org/apache/commons/collections4/iterators/LoopingIteratorTest.java
@@ -21,9 +21,9 @@ import java.util.Arrays;
import java.util.List;
import java.util.NoSuchElementException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
/**
* Tests the LoopingIterator class.
@@ -51,7 +51,7 @@ public class LoopingIteratorTest {
public void testLooping0() throws Exception {
final List<Object> list = new ArrayList<>();
final LoopingIterator<Object> loop = new LoopingIterator<>(list);
- assertTrue("hasNext should return false", !loop.hasNext());
+ assertTrue(!loop.hasNext(), "hasNext should return false");
try {
loop.next();
@@ -69,13 +69,13 @@ public class LoopingIteratorTest {
final List<String> list = Arrays.asList("a");
final LoopingIterator<String> loop = new LoopingIterator<>(list);
- assertTrue("1st hasNext should return true", loop.hasNext());
+ assertTrue(loop.hasNext(), "1st hasNext should return true");
assertEquals("a", loop.next());
- assertTrue("2nd hasNext should return true", loop.hasNext());
+ assertTrue(loop.hasNext(), "2nd hasNext should return true");
assertEquals("a", loop.next());
- assertTrue("3rd hasNext should return true", loop.hasNext());
+ assertTrue(loop.hasNext(), "3rd hasNext should return true");
assertEquals("a", loop.next());
}
@@ -89,13 +89,13 @@ public class LoopingIteratorTest {
final List<String> list = Arrays.asList("a", "b");
final LoopingIterator<String> loop = new LoopingIterator<>(list);
- assertTrue("1st hasNext should return true", loop.hasNext());
+ assertTrue(loop.hasNext(), "1st hasNext should return true");
assertEquals("a", loop.next());
- assertTrue("2nd hasNext should return true", loop.hasNext());
+ assertTrue(loop.hasNext(), "2nd hasNext should return true");
assertEquals("b", loop.next());
- assertTrue("3rd hasNext should return true", loop.hasNext());
+ assertTrue(loop.hasNext(), "3rd hasNext should return true");
assertEquals("a", loop.next());
}
@@ -109,16 +109,16 @@ public class LoopingIteratorTest {
final List<String> list = Arrays.asList("a", "b", "c");
final LoopingIterator<String> loop = new LoopingIterator<>(list);
- assertTrue("1st hasNext should return true", loop.hasNext());
+ assertTrue(loop.hasNext(), "1st hasNext should return true");
assertEquals("a", loop.next());
- assertTrue("2nd hasNext should return true", loop.hasNext());
+ assertTrue(loop.hasNext(), "2nd hasNext should return true");
assertEquals("b", loop.next());
- assertTrue("3rd hasNext should return true", loop.hasNext());
+ assertTrue(loop.hasNext(), "3rd hasNext should return true");
assertEquals("c", loop.next());
- assertTrue("4th hasNext should return true", loop.hasNext());
+ assertTrue(loop.hasNext(), "4th hasNext should return true");
assertEquals("a", loop.next());
}
@@ -131,24 +131,24 @@ public class LoopingIteratorTest {
public void testRemoving1() throws Exception {
final List<String> list = new ArrayList<>(Arrays.asList("a", "b",
"c"));
final LoopingIterator<String> loop = new LoopingIterator<>(list);
- assertEquals("list should have 3 elements.", 3, list.size());
+ assertEquals(3, list.size(), "list should have 3 elements.");
- assertTrue("1st hasNext should return true", loop.hasNext());
+ assertTrue(loop.hasNext(), "1st hasNext should return true");
assertEquals("a", loop.next());
loop.remove(); // removes a
- assertEquals("list should have 2 elements.", 2, list.size());
+ assertEquals(2, list.size(), "list should have 2 elements.");
- assertTrue("2nd hasNext should return true", loop.hasNext());
+ assertTrue(loop.hasNext(), "2nd hasNext should return true");
assertEquals("b", loop.next());
loop.remove(); // removes b
- assertEquals("list should have 1 elements.", 1, list.size());
+ assertEquals(1, list.size(), "list should have 1 elements.");
- assertTrue("3rd hasNext should return true", loop.hasNext());
+ assertTrue(loop.hasNext(), "3rd hasNext should return true");
assertEquals("c", loop.next());
loop.remove(); // removes c
- assertEquals("list should have 0 elements.", 0, list.size());
+ assertEquals(0, list.size(), "list should have 0 elements.");
- assertFalse("4th hasNext should return false", loop.hasNext());
+ assertFalse(loop.hasNext(), "4th hasNext should return false");
try {
loop.next();
fail("Expected NoSuchElementException to be thrown.");
diff --git
a/src/test/java/org/apache/commons/collections4/iterators/LoopingListIteratorTest.java
b/src/test/java/org/apache/commons/collections4/iterators/LoopingListIteratorTest.java
index a3bf48b..53b61c4 100644
---
a/src/test/java/org/apache/commons/collections4/iterators/LoopingListIteratorTest.java
+++
b/src/test/java/org/apache/commons/collections4/iterators/LoopingListIteratorTest.java
@@ -21,8 +21,8 @@ import java.util.Arrays;
import java.util.List;
import java.util.NoSuchElementException;
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.*;
/**
* Tests the LoopingListIterator class.
diff --git
a/src/test/java/org/apache/commons/collections4/keyvalue/AbstractMapEntryTest.java
b/src/test/java/org/apache/commons/collections4/keyvalue/AbstractMapEntryTest.java
index 4ad9851..fb3b4e2 100644
---
a/src/test/java/org/apache/commons/collections4/keyvalue/AbstractMapEntryTest.java
+++
b/src/test/java/org/apache/commons/collections4/keyvalue/AbstractMapEntryTest.java
@@ -19,8 +19,8 @@ package org.apache.commons.collections4.keyvalue;
import java.util.HashMap;
import java.util.Map;
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.*;
/**
* Abstract tests that can be extended to test any Map.Entry implementation.
diff --git
a/src/test/java/org/apache/commons/collections4/keyvalue/DefaultKeyValueTest.java
b/src/test/java/org/apache/commons/collections4/keyvalue/DefaultKeyValueTest.java
index 9a83655..e0cbb68 100644
---
a/src/test/java/org/apache/commons/collections4/keyvalue/DefaultKeyValueTest.java
+++
b/src/test/java/org/apache/commons/collections4/keyvalue/DefaultKeyValueTest.java
@@ -16,12 +16,12 @@
*/
package org.apache.commons.collections4.keyvalue;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.HashMap;
import java.util.Map;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
/**
* Test the DefaultKeyValue class.
diff --git
a/src/test/java/org/apache/commons/collections4/keyvalue/DefaultMapEntryTest.java
b/src/test/java/org/apache/commons/collections4/keyvalue/DefaultMapEntryTest.java
index 1fe8b40..15ab71a 100644
---
a/src/test/java/org/apache/commons/collections4/keyvalue/DefaultMapEntryTest.java
+++
b/src/test/java/org/apache/commons/collections4/keyvalue/DefaultMapEntryTest.java
@@ -19,9 +19,9 @@ package org.apache.commons.collections4.keyvalue;
import java.util.Map;
import org.apache.commons.collections4.KeyValue;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
/**
* Test the DefaultMapEntry class.
diff --git
a/src/test/java/org/apache/commons/collections4/keyvalue/MultiKeyTest.java
b/src/test/java/org/apache/commons/collections4/keyvalue/MultiKeyTest.java
index bf597b2..e447f98 100644
--- a/src/test/java/org/apache/commons/collections4/keyvalue/MultiKeyTest.java
+++ b/src/test/java/org/apache/commons/collections4/keyvalue/MultiKeyTest.java
@@ -16,7 +16,7 @@
*/
package org.apache.commons.collections4.keyvalue;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -28,7 +28,7 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
/**
* Unit tests for {@link org.apache.commons.collections4.keyvalue.MultiKey}.
diff --git
a/src/test/java/org/apache/commons/collections4/keyvalue/TiedMapEntryTest.java
b/src/test/java/org/apache/commons/collections4/keyvalue/TiedMapEntryTest.java
index b496e6a..ab8314b 100644
---
a/src/test/java/org/apache/commons/collections4/keyvalue/TiedMapEntryTest.java
+++
b/src/test/java/org/apache/commons/collections4/keyvalue/TiedMapEntryTest.java
@@ -16,11 +16,11 @@
*/
package org.apache.commons.collections4.keyvalue;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.HashMap;
import java.util.Map;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
/**
* Test the TiedMapEntry class.
diff --git
a/src/test/java/org/apache/commons/collections4/keyvalue/UnmodifiableMapEntryTest.java
b/src/test/java/org/apache/commons/collections4/keyvalue/UnmodifiableMapEntryTest.java
index 00ecf52..569d25e 100644
---
a/src/test/java/org/apache/commons/collections4/keyvalue/UnmodifiableMapEntryTest.java
+++
b/src/test/java/org/apache/commons/collections4/keyvalue/UnmodifiableMapEntryTest.java
@@ -20,9 +20,9 @@ import java.util.Map;
import org.apache.commons.collections4.KeyValue;
import org.apache.commons.collections4.Unmodifiable;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
/**
* Test the UnmodifiableMapEntry class.
diff --git
a/src/test/java/org/apache/commons/collections4/properties/EmptyPropertiesTest.java
b/src/test/java/org/apache/commons/collections4/properties/EmptyPropertiesTest.java
index 515cb39..d5723ad 100644
---
a/src/test/java/org/apache/commons/collections4/properties/EmptyPropertiesTest.java
+++
b/src/test/java/org/apache/commons/collections4/properties/EmptyPropertiesTest.java
@@ -28,24 +28,29 @@ import java.util.Properties;
import org.apache.commons.io.input.NullReader;
import org.apache.commons.lang3.ArrayUtils;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
public class EmptyPropertiesTest {
@Test
public void testClear() {
PropertiesFactory.EMPTY_PROPERTIES.clear();
- Assert.assertEquals(0, PropertiesFactory.EMPTY_PROPERTIES.size());
+ assertEquals(0, PropertiesFactory.EMPTY_PROPERTIES.size());
}
@Test
public void testClone() {
// TODO Better test?
PropertiesFactory.EMPTY_PROPERTIES.clone();
- Assert.assertEquals(0, PropertiesFactory.EMPTY_PROPERTIES.size());
+ assertEquals(0, PropertiesFactory.EMPTY_PROPERTIES.size());
}
@Test
@@ -65,86 +70,86 @@ public class EmptyPropertiesTest {
@Test
public void testContains() {
- Assert.assertFalse(PropertiesFactory.EMPTY_PROPERTIES.contains("foo"));
+ assertFalse(PropertiesFactory.EMPTY_PROPERTIES.contains("foo"));
}
@Test
public void testContainsKey() {
-
Assert.assertFalse(PropertiesFactory.EMPTY_PROPERTIES.containsKey("foo"));
+ assertFalse(PropertiesFactory.EMPTY_PROPERTIES.containsKey("foo"));
}
@Test
public void testContainsValue() {
-
Assert.assertFalse(PropertiesFactory.EMPTY_PROPERTIES.containsValue("foo"));
+ assertFalse(PropertiesFactory.EMPTY_PROPERTIES.containsValue("foo"));
}
@Test
public void testElements() {
-
Assert.assertFalse(PropertiesFactory.EMPTY_PROPERTIES.elements().hasMoreElements());
+
assertFalse(PropertiesFactory.EMPTY_PROPERTIES.elements().hasMoreElements());
}
@Test
public void testEntrySet() {
-
Assert.assertTrue(PropertiesFactory.EMPTY_PROPERTIES.entrySet().isEmpty());
+ assertTrue(PropertiesFactory.EMPTY_PROPERTIES.entrySet().isEmpty());
}
@Test
public void testEquals() {
-
Assert.assertTrue(PropertiesFactory.EMPTY_PROPERTIES.equals(PropertiesFactory.EMPTY_PROPERTIES));
- Assert.assertTrue(PropertiesFactory.EMPTY_PROPERTIES.equals(new
Properties()));
- Assert.assertTrue(new
Properties().equals(PropertiesFactory.EMPTY_PROPERTIES));
- Assert.assertFalse(PropertiesFactory.EMPTY_PROPERTIES.equals(null));
+
assertTrue(PropertiesFactory.EMPTY_PROPERTIES.equals(PropertiesFactory.EMPTY_PROPERTIES));
+ assertTrue(PropertiesFactory.EMPTY_PROPERTIES.equals(new
Properties()));
+ assertTrue(new
Properties().equals(PropertiesFactory.EMPTY_PROPERTIES));
+ assertFalse(PropertiesFactory.EMPTY_PROPERTIES.equals(null));
final Properties p = new Properties();
p.put("Key", "Value");
- Assert.assertFalse(PropertiesFactory.EMPTY_PROPERTIES.equals(p));
- Assert.assertFalse(p.equals(PropertiesFactory.EMPTY_PROPERTIES));
+ assertFalse(PropertiesFactory.EMPTY_PROPERTIES.equals(p));
+ assertFalse(p.equals(PropertiesFactory.EMPTY_PROPERTIES));
}
public void testForEach() {
- PropertiesFactory.EMPTY_PROPERTIES.forEach((k, v) -> Assert.fail());
+ PropertiesFactory.EMPTY_PROPERTIES.forEach((k, v) -> fail());
}
@Test
public void testGet() {
- Assert.assertNull(PropertiesFactory.EMPTY_PROPERTIES.get("foo"));
+ assertNull(PropertiesFactory.EMPTY_PROPERTIES.get("foo"));
}
@Test
public void testGetOrDefault() {
- Assert.assertEquals("bar",
PropertiesFactory.EMPTY_PROPERTIES.getOrDefault("foo", "bar"));
+ assertEquals("bar",
PropertiesFactory.EMPTY_PROPERTIES.getOrDefault("foo", "bar"));
}
@Test
public void testGetProperty() {
-
Assert.assertNull(PropertiesFactory.EMPTY_PROPERTIES.getProperty("foo"));
+ assertNull(PropertiesFactory.EMPTY_PROPERTIES.getProperty("foo"));
}
@Test
public void testGetPropertyDefault() {
- Assert.assertEquals("bar",
PropertiesFactory.EMPTY_PROPERTIES.getProperty("foo", "bar"));
+ assertEquals("bar",
PropertiesFactory.EMPTY_PROPERTIES.getProperty("foo", "bar"));
}
@Test
public void testHashCode() {
- Assert.assertEquals(PropertiesFactory.EMPTY_PROPERTIES.hashCode(),
+ assertEquals(PropertiesFactory.EMPTY_PROPERTIES.hashCode(),
PropertiesFactory.EMPTY_PROPERTIES.hashCode());
// Should be equals?
- // Assert.assertEquals(PropertiesFactory.EMPTY_PROPERTIES.hashCode(),
new Properties().hashCode());
+ // assertEquals(PropertiesFactory.EMPTY_PROPERTIES.hashCode(), new
Properties().hashCode());
}
@Test
public void testIsEmpty() {
- Assert.assertTrue(PropertiesFactory.EMPTY_PROPERTIES.isEmpty());
+ assertTrue(PropertiesFactory.EMPTY_PROPERTIES.isEmpty());
}
@Test
public void testKeys() {
-
Assert.assertFalse(PropertiesFactory.EMPTY_PROPERTIES.keys().hasMoreElements());
+
assertFalse(PropertiesFactory.EMPTY_PROPERTIES.keys().hasMoreElements());
}
@Test
public void testKeySet() {
-
Assert.assertTrue(PropertiesFactory.EMPTY_PROPERTIES.keySet().isEmpty());
+ assertTrue(PropertiesFactory.EMPTY_PROPERTIES.keySet().isEmpty());
}
@Test
@@ -155,10 +160,10 @@ public class EmptyPropertiesTest {
// expected
final ByteArrayOutputStream expected = new ByteArrayOutputStream();
PropertiesFactory.INSTANCE.createProperties().list(new
PrintStream(expected));
- Assert.assertArrayEquals(expected.toByteArray(), actual.toByteArray());
+ assertArrayEquals(expected.toByteArray(), actual.toByteArray());
expected.reset();
new Properties().list(new PrintStream(expected));
- Assert.assertArrayEquals(expected.toByteArray(), actual.toByteArray());
+ assertArrayEquals(expected.toByteArray(), actual.toByteArray());
}
@Test
@@ -169,10 +174,10 @@ public class EmptyPropertiesTest {
// expected
final ByteArrayOutputStream expected = new ByteArrayOutputStream();
PropertiesFactory.INSTANCE.createProperties().list(new
PrintWriter(expected));
- Assert.assertArrayEquals(expected.toByteArray(), actual.toByteArray());
+ assertArrayEquals(expected.toByteArray(), actual.toByteArray());
expected.reset();
new Properties().list(new PrintWriter(expected));
- Assert.assertArrayEquals(expected.toByteArray(), actual.toByteArray());
+ assertArrayEquals(expected.toByteArray(), actual.toByteArray());
}
@Test
@@ -199,7 +204,7 @@ public class EmptyPropertiesTest {
@Test
public void testPropertyName() {
-
Assert.assertFalse(PropertiesFactory.EMPTY_PROPERTIES.propertyNames().hasMoreElements());
+
assertFalse(PropertiesFactory.EMPTY_PROPERTIES.propertyNames().hasMoreElements());
}
@Test
@@ -261,12 +266,12 @@ public class EmptyPropertiesTest {
try (PrintStream out = new PrintStream(expected)) {
PropertiesFactory.INSTANCE.createProperties().save(out,
comments);
}
- Assert.assertArrayEquals(expected.toByteArray(),
actual.toByteArray());
+ assertArrayEquals(expected.toByteArray(),
actual.toByteArray());
expected.reset();
try (PrintStream out = new PrintStream(expected)) {
new Properties().save(out, comments);
}
- Assert.assertArrayEquals(expected.toByteArray(),
actual.toByteArray());
+ assertArrayEquals(expected.toByteArray(),
actual.toByteArray());
}
}
}
@@ -278,7 +283,7 @@ public class EmptyPropertiesTest {
@Test
public void testSize() {
- Assert.assertEquals(0, PropertiesFactory.EMPTY_PROPERTIES.size());
+ assertEquals(0, PropertiesFactory.EMPTY_PROPERTIES.size());
}
@Test
@@ -290,10 +295,10 @@ public class EmptyPropertiesTest {
// expected
final ByteArrayOutputStream expected = new ByteArrayOutputStream();
PropertiesFactory.INSTANCE.createProperties().store(new
PrintStream(expected), comments);
- Assert.assertArrayEquals(expected.toByteArray(), actual.toByteArray());
+ assertArrayEquals(expected.toByteArray(), actual.toByteArray());
expected.reset();
new Properties().store(new PrintStream(expected), comments);
- Assert.assertArrayEquals(expected.toByteArray(), actual.toByteArray());
+ assertArrayEquals(expected.toByteArray(), actual.toByteArray());
}
@Test
@@ -305,10 +310,10 @@ public class EmptyPropertiesTest {
// expected
final ByteArrayOutputStream expected = new ByteArrayOutputStream();
PropertiesFactory.INSTANCE.createProperties().store(new
PrintWriter(expected), comments);
- Assert.assertArrayEquals(expected.toByteArray(), actual.toByteArray());
+ assertArrayEquals(expected.toByteArray(), actual.toByteArray());
expected.reset();
new Properties().store(new PrintWriter(expected), comments);
- Assert.assertArrayEquals(expected.toByteArray(), actual.toByteArray());
+ assertArrayEquals(expected.toByteArray(), actual.toByteArray());
}
@Test
@@ -320,10 +325,10 @@ public class EmptyPropertiesTest {
// expected
final ByteArrayOutputStream expected = new ByteArrayOutputStream();
PropertiesFactory.INSTANCE.createProperties().storeToXML(new
PrintStream(expected), comments);
- Assert.assertArrayEquals(expected.toByteArray(), actual.toByteArray());
+ assertArrayEquals(expected.toByteArray(), actual.toByteArray());
expected.reset();
new Properties().storeToXML(new PrintStream(expected), comments);
- Assert.assertArrayEquals(expected.toByteArray(), actual.toByteArray());
+ assertArrayEquals(expected.toByteArray(), actual.toByteArray());
}
@Test
@@ -336,24 +341,24 @@ public class EmptyPropertiesTest {
// expected
final ByteArrayOutputStream expected = new ByteArrayOutputStream();
PropertiesFactory.INSTANCE.createProperties().storeToXML(new
PrintStream(expected), comments, encoding);
- Assert.assertArrayEquals(expected.toByteArray(), actual.toByteArray());
+ assertArrayEquals(expected.toByteArray(), actual.toByteArray());
expected.reset();
new Properties().storeToXML(new PrintStream(expected), comments,
encoding);
- Assert.assertArrayEquals(expected.toByteArray(), actual.toByteArray());
+ assertArrayEquals(expected.toByteArray(), actual.toByteArray());
}
@Test
public void testStringPropertyName() {
-
Assert.assertTrue(PropertiesFactory.EMPTY_PROPERTIES.stringPropertyNames().isEmpty());
+
assertTrue(PropertiesFactory.EMPTY_PROPERTIES.stringPropertyNames().isEmpty());
}
@Test
public void testToString() {
- Assert.assertEquals(new Properties().toString(),
PropertiesFactory.EMPTY_PROPERTIES.toString());
+ assertEquals(new Properties().toString(),
PropertiesFactory.EMPTY_PROPERTIES.toString());
}
@Test
public void testValues() {
-
Assert.assertTrue(PropertiesFactory.EMPTY_PROPERTIES.values().isEmpty());
+ assertTrue(PropertiesFactory.EMPTY_PROPERTIES.values().isEmpty());
}
}
diff --git
a/src/test/java/org/apache/commons/collections4/sequence/SequencesComparatorTest.java
b/src/test/java/org/apache/commons/collections4/sequence/SequencesComparatorTest.java
index 110cb7b..4ed0737 100644
---
a/src/test/java/org/apache/commons/collections4/sequence/SequencesComparatorTest.java
+++
b/src/test/java/org/apache/commons/collections4/sequence/SequencesComparatorTest.java
@@ -21,10 +21,12 @@ import java.util.Arrays;
import java.util.List;
import java.util.Random;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class SequencesComparatorTest {
@@ -38,7 +40,7 @@ public class SequencesComparatorTest {
final SequencesComparator<Character> comparator =
new SequencesComparator<>(sequence(before.get(i)),
sequence(after.get(i)));
- Assert.assertEquals(length[i],
comparator.getScript().getModifications());
+ assertEquals(length[i], comparator.getScript().getModifications());
}
}
@@ -49,7 +51,7 @@ public class SequencesComparatorTest {
ev.setList(sequence(before.get(i)));
new SequencesComparator<>(sequence(before.get(i)),
sequence(after.get(i))).getScript().visit(ev);
- Assert.assertEquals(after.get(i), ev.getString());
+ assertEquals(after.get(i), ev.getString());
}
}
@@ -100,7 +102,7 @@ public class SequencesComparatorTest {
final SequencesComparator<String> comparator =
new SequencesComparator<>(sentenceBefore, sentenceAfter);
- Assert.assertTrue(comparator.getScript().getModifications() <=
nbCom);
+ assertTrue(comparator.getScript().getModifications() <= nbCom);
}
}
@@ -139,7 +141,7 @@ public class SequencesComparatorTest {
for (final String s : shadokSentence) {
concat.append(s);
}
- Assert.assertEquals(concat.toString(), ev.getString());
+ assertEquals(concat.toString(), ev.getString());
}
}
}
@@ -187,7 +189,7 @@ public class SequencesComparatorTest {
}
- @Before
+ @BeforeEach
public void setUp() {
before = Arrays.asList(
@@ -226,7 +228,7 @@ public class SequencesComparatorTest {
}
- @After
+ @AfterEach
public void tearDown() {
before = null;
after = null;