From aa357f8b644bdffcba977fdacdb3bb5f687d1b6d Mon Sep 17 00:00:00 2001 From: Niket Agrawal Date: Thu, 16 Nov 2023 14:43:14 +0530 Subject: [PATCH] Review comment update --- .../firstmatchingelement/FirstMatchingElementUnitTest.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/core-java-modules/core-java-streams-5/src/test/java/com/baeldung/streams/firstmatchingelement/FirstMatchingElementUnitTest.java b/core-java-modules/core-java-streams-5/src/test/java/com/baeldung/streams/firstmatchingelement/FirstMatchingElementUnitTest.java index 347dadf961..dbca587ec1 100644 --- a/core-java-modules/core-java-streams-5/src/test/java/com/baeldung/streams/firstmatchingelement/FirstMatchingElementUnitTest.java +++ b/core-java-modules/core-java-streams-5/src/test/java/com/baeldung/streams/firstmatchingelement/FirstMatchingElementUnitTest.java @@ -43,7 +43,6 @@ public class FirstMatchingElementUnitTest { @Test public void whenUsingTakeWhile_thenFindFirstMatchingUserIndex() { - int lastIndex = userList.size() - 1; AtomicInteger counter = new AtomicInteger(-1); int predicateIndex = userList.stream() .takeWhile(user -> { @@ -54,11 +53,7 @@ public class FirstMatchingElementUnitTest { .max() .orElse(-1); - if (predicateIndex != 1 && predicateIndex != lastIndex) { - assertEquals(1, predicateIndex + 1); - } else { - assertEquals(lastIndex, predicateIndex); - } + assertEquals(1, predicateIndex + 1); } @Test