diff --git a/core-java/src/test/java/com/baeldung/stream/StreamIndicesTest.java b/core-java/src/test/java/com/baeldung/stream/StreamIndicesTest.java index d8513417ea..a02ef4031e 100644 --- a/core-java/src/test/java/com/baeldung/stream/StreamIndicesTest.java +++ b/core-java/src/test/java/com/baeldung/stream/StreamIndicesTest.java @@ -1,19 +1,18 @@ package com.baeldung.stream; -import static org.junit.Assert.assertEquals; +import com.codepoetics.protonpack.Indexed; +import org.junit.Test; import java.util.Arrays; import java.util.List; -import org.junit.Test; - -import com.codepoetics.protonpack.Indexed; +import static org.junit.Assert.assertEquals; public class StreamIndicesTest { @Test - public void givenArray_whenGetIndexedStrings_thenReturnListOfEvenIndexedStrings() { - String[] names = { "Afrim", "Bashkim", "Besim", "Lulzim", "Durim", "Shpetim" }; + public void whenCalled_thenReturnListOfEvenIndexedStrings() { + String[] names = {"Afrim", "Bashkim", "Besim", "Lulzim", "Durim", "Shpetim"}; List expectedResult = Arrays.asList("Afrim", "Besim", "Durim"); List actualResult = StreamIndices.getEvenIndexedStrings(names); @@ -21,8 +20,8 @@ public class StreamIndicesTest { } @Test - public void givenArray_whenGetIndexedStrings_thenReturnListOfEvenIndexedStringsVersionTwo() { - String[] names = { "Afrim", "Bashkim", "Besim", "Lulzim", "Durim", "Shpetim" }; + public void whenCalled_thenReturnListOfEvenIndexedStringsVersionTwo() { + String[] names = {"Afrim", "Bashkim", "Besim", "Lulzim", "Durim", "Shpetim"}; List expectedResult = Arrays.asList("Afrim", "Besim", "Durim"); List actualResult = StreamIndices.getEvenIndexedStrings(names); @@ -30,8 +29,8 @@ public class StreamIndicesTest { } @Test - public void givenArray_whenGetIndexedStrings_thenReturnListOfOddStrings() { - String[] names = { "Afrim", "Bashkim", "Besim", "Lulzim", "Durim", "Shpetim" }; + public void whenCalled_thenReturnListOfOddStrings() { + String[] names = {"Afrim", "Bashkim", "Besim", "Lulzim", "Durim", "Shpetim"}; List expectedResult = Arrays.asList("Bashkim", "Lulzim", "Shpetim"); List actualResult = StreamIndices.getOddIndexedStrings(names); @@ -39,30 +38,33 @@ public class StreamIndicesTest { } @Test - public void givenList_whenGetIndexedStrings_thenReturnListOfEvenIndexedStrings() { + public void givenList_whenCalled_thenReturnListOfEvenIndexedStrings() { List names = Arrays.asList("Afrim", "Bashkim", "Besim", "Lulzim", "Durim", "Shpetim"); - List> expectedResult = Arrays.asList(Indexed.index(0, "Afrim"), Indexed.index(2, "Besim"), Indexed.index(4, "Durim")); + List> expectedResult = Arrays + .asList(Indexed.index(0, "Afrim"), Indexed.index(2, "Besim"), Indexed + .index(4, "Durim")); List> actualResult = StreamIndices.getEvenIndexedStrings(names); assertEquals(expectedResult, actualResult); } @Test - public void givenList_whenGetIndexedStrings_thenReturnListOfOddIndexedStrings() { + public void givenList_whenCalled_thenReturnListOfOddIndexedStrings() { List names = Arrays.asList("Afrim", "Bashkim", "Besim", "Lulzim", "Durim", "Shpetim"); - List> expectedResult = Arrays.asList(Indexed.index(1, "Bashkim"), Indexed.index(3, "Lulzim"), Indexed.index(5, "Shpetim")); + List> expectedResult = Arrays + .asList(Indexed.index(1, "Bashkim"), Indexed.index(3, "Lulzim"), Indexed + .index(5, "Shpetim")); List> actualResult = StreamIndices.getOddIndexedStrings(names); assertEquals(expectedResult, actualResult); } @Test - public void givenArray_whenGetIndexedStrings_thenReturnListOfOddStringsVersionTwo() { - String[] names = { "Afrim", "Bashkim", "Besim", "Lulzim", "Durim", "Shpetim" }; + public void whenCalled_thenReturnListOfOddStringsVersionTwo() { + String[] names = {"Afrim", "Bashkim", "Besim", "Lulzim", "Durim", "Shpetim"}; List expectedResult = Arrays.asList("Bashkim", "Lulzim", "Shpetim"); List actualResult = StreamIndices.getOddIndexedStringsVersionTwo(names); assertEquals(expectedResult, actualResult); } - } \ No newline at end of file