diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertIterableEquals.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertIterableEquals.java index 10dfa911d10..13d04d9f407 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertIterableEquals.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertIterableEquals.java @@ -69,7 +69,7 @@ private static void assertIterableEquals(Iterable expected, Iterable actua } // Prevent stack overflow error. // See https://github.com/junit-team/junit5/issues/2157 for details. - if (expectedElement != null && expectedElement.equals(actualElement)) { + if (Objects.equals(expectedElement, actualElement)) { continue; }