From 1155a6d8e842e901ce2606d05348569156546c3b Mon Sep 17 00:00:00 2001 From: Imran Alam <75203259+Imranalam28@users.noreply.github.com> Date: Fri, 1 Mar 2024 13:19:42 +0530 Subject: [PATCH] Update PeakElementFinderUnitTest.java --- .../peakelements/PeakElementFinderUnitTest.java | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/core-java-modules/core-java-collections-array-list-2/src/test/java/com/baeldung/peakelements/PeakElementFinderUnitTest.java b/core-java-modules/core-java-collections-array-list-2/src/test/java/com/baeldung/peakelements/PeakElementFinderUnitTest.java index 8ed6c9a991..9cd33d8aa0 100644 --- a/core-java-modules/core-java-collections-array-list-2/src/test/java/com/baeldung/peakelements/PeakElementFinderUnitTest.java +++ b/core-java-modules/core-java-collections-array-list-2/src/test/java/com/baeldung/peakelements/PeakElementFinderUnitTest.java @@ -8,19 +8,11 @@ import static org.junit.jupiter.api.Assertions.*; public class PeakElementFinderUnitTest { - @Test - void findPeakElement_givenArrayOfIntegers_whenValidInput_thenReturnsCorrectPeakIndex() { - PeakElementFinder finder = new PeakElementFinder(); - int[] array = {5, 8, 7, 6, 12}; - List peaks = finder.findPeakElement(array); - assertEquals(2, peaks.size() ); - } - @Test void findPeakElement_givenArrayOfIntegers_whenNoPeaks_thenReturnsMinusOne() { PeakElementFinder finder = new PeakElementFinder(); int[] array = {5, 8, 7, 6, 12}; - List peaks = finder.findPeakElement(array); + List peaks = finder.findPeakElements(array); assertEquals(2, peaks.size()); } @@ -28,7 +20,7 @@ public class PeakElementFinderUnitTest { void findPeakElement_givenArrayOfIntegers_whenPeaksAtExtremes_thenReturnsCorrectPeakIndex() { PeakElementFinder finder = new PeakElementFinder(); int[] array = {5, 2, 1, 3, 4}; - List peaks = finder.findPeakElement(array); + List peaks = finder.findPeakElements(array); assertEquals(2, peaks.size()); } @@ -36,7 +28,7 @@ public class PeakElementFinderUnitTest { void findPeakElement_givenArrayOfIntegers_whenPlateaus_thenReturnsCorrectPeakIndex() { PeakElementFinder finder = new PeakElementFinder(); int[] array = {1, 2, 2, 2, 3, 4, 5}; - List peaks = finder.findPeakElement(array); - assertEquals(2, peaks.size()); + List peaks = finder.findPeakElements(array); + assertEquals(1, peaks.size()); } }