diff --git a/pom.xml b/pom.xml
index 195a2e03c..d243ddf4f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -48,12 +48,6 @@
junit-jupiter-params
test
-
- org.hamcrest
- hamcrest
- 3.0
- test
-
org.easymock
easymock
diff --git a/src/test/java/org/apache/commons/collections4/iterators/BoundedIteratorTest.java b/src/test/java/org/apache/commons/collections4/iterators/BoundedIteratorTest.java
index 36f66236e..52f8f8238 100644
--- a/src/test/java/org/apache/commons/collections4/iterators/BoundedIteratorTest.java
+++ b/src/test/java/org/apache/commons/collections4/iterators/BoundedIteratorTest.java
@@ -16,14 +16,11 @@
*/
package org.apache.commons.collections4.iterators;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsEqual.equalTo;
-import static org.hamcrest.core.IsNull.nullValue;
import static org.junit.jupiter.api.Assertions.assertEquals;
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 static org.junit.jupiter.api.Assertions.assertNull;
import java.util.ArrayList;
import java.util.Arrays;
@@ -142,7 +139,7 @@ public class BoundedIteratorTest extends AbstractIteratorTest {
@Test
public void testNegativeMax() {
final IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, () -> new BoundedIterator<>(testList.iterator(), 3, -1));
- assertThat(thrown.getMessage(), is(equalTo("Max parameter must not be negative.")));
+ assertEquals("Max parameter must not be negative.", thrown.getMessage());
}
/**
@@ -152,7 +149,7 @@ public class BoundedIteratorTest extends AbstractIteratorTest {
@Test
public void testNegativeOffset() {
final IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, () -> new BoundedIterator<>(testList.iterator(), -1, 4));
- assertThat(thrown.getMessage(), is(equalTo("Offset parameter must not be negative.")));
+ assertEquals("Offset parameter must not be negative.", thrown.getMessage());
}
/**
@@ -236,7 +233,7 @@ public class BoundedIteratorTest extends AbstractIteratorTest {
assertFalse(iter.hasNext());
final NoSuchElementException thrown = assertThrows(NoSuchElementException.class, () -> iter.next());
- assertThat(thrown.getMessage(), is(nullValue()));
+ assertNull(thrown.getMessage());
iter.remove();
assertFalse(testListCopy.contains("f"));
@@ -244,7 +241,7 @@ public class BoundedIteratorTest extends AbstractIteratorTest {
assertFalse(iter.hasNext());
final NoSuchElementException thrown1 = assertThrows(NoSuchElementException.class, () -> iter.next());
- assertThat(thrown1.getMessage(), is(nullValue()));
+ assertNull(thrown1.getMessage());
}
/**
@@ -294,7 +291,8 @@ public class BoundedIteratorTest extends AbstractIteratorTest {
assertEquals("b", iter.next());
final UnsupportedOperationException thrown = assertThrows(UnsupportedOperationException.class, () -> iter.remove());
- assertThat(thrown.getMessage(), is(nullValue()));
+ assertNull(thrown.getMessage());
+
}
/**
@@ -307,7 +305,7 @@ public class BoundedIteratorTest extends AbstractIteratorTest {
final Iterator iter = new BoundedIterator<>(testListCopy.iterator(), 1, 5);
final IllegalStateException thrown = assertThrows(IllegalStateException.class, () -> iter.remove());
- assertThat(thrown.getMessage(), is(equalTo("remove() can not be called before calling next()")));
+ assertEquals("remove() can not be called before calling next()", thrown.getMessage());
}
/**
diff --git a/src/test/java/org/apache/commons/collections4/list/GrowthListTest.java b/src/test/java/org/apache/commons/collections4/list/GrowthListTest.java
index 33aa99a16..a8764c0c4 100644
--- a/src/test/java/org/apache/commons/collections4/list/GrowthListTest.java
+++ b/src/test/java/org/apache/commons/collections4/list/GrowthListTest.java
@@ -16,9 +16,6 @@
*/
package org.apache.commons.collections4.list;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
@@ -131,7 +128,7 @@ public class GrowthListTest extends AbstractListTest {
final Executable testMethod = () -> list.add(-1, element);
final IndexOutOfBoundsException thrown = assertThrows(IndexOutOfBoundsException.class, testMethod,
"List.add should throw IndexOutOfBoundsException [-1]");
- assertThat(thrown.getMessage(), is(equalTo("Index: -1, Size: 0")));
+ assertEquals("Index: -1, Size: 0", thrown.getMessage());
}
/**