diff --git a/src/test/java/org/apache/commons/collections4/iterators/AbstractIteratorTest.java b/src/test/java/org/apache/commons/collections4/iterators/AbstractIteratorTest.java index b1779571a9..6f4d6597f0 100644 --- a/src/test/java/org/apache/commons/collections4/iterators/AbstractIteratorTest.java +++ b/src/test/java/org/apache/commons/collections4/iterators/AbstractIteratorTest.java @@ -157,10 +157,7 @@ public void testRemove() { if (!supportsRemove()) { // check for UnsupportedOperationException if not supported - try { - it.remove(); - } catch (final UnsupportedOperationException ex) { - } + assertThrows(UnsupportedOperationException.class, it::remove); return; }