11package com .baeldung .stream ;
22
3- import static org .junit .Assert .assertEquals ;
3+ import com .codepoetics .protonpack .Indexed ;
4+ import org .junit .Test ;
45
56import java .util .Arrays ;
67import java .util .List ;
78
8- import org .junit .Test ;
9-
10- import com .codepoetics .protonpack .Indexed ;
9+ import static org .junit .Assert .assertEquals ;
1110
1211public class StreamIndicesTest {
1312
1413 @ Test
15- public void givenArray_whenGetIndexedStrings_thenReturnListOfEvenIndexedStrings () {
16- String [] names = { "Afrim" , "Bashkim" , "Besim" , "Lulzim" , "Durim" , "Shpetim" };
14+ public void whenCalled_thenReturnListOfEvenIndexedStrings () {
15+ String [] names = {"Afrim" , "Bashkim" , "Besim" , "Lulzim" , "Durim" , "Shpetim" };
1716 List <String > expectedResult = Arrays .asList ("Afrim" , "Besim" , "Durim" );
1817 List <String > actualResult = StreamIndices .getEvenIndexedStrings (names );
1918
2019 assertEquals (expectedResult , actualResult );
2120 }
2221
2322 @ Test
24- public void givenArray_whenGetIndexedStrings_thenReturnListOfEvenIndexedStringsVersionTwo () {
25- String [] names = { "Afrim" , "Bashkim" , "Besim" , "Lulzim" , "Durim" , "Shpetim" };
23+ public void whenCalled_thenReturnListOfEvenIndexedStringsVersionTwo () {
24+ String [] names = {"Afrim" , "Bashkim" , "Besim" , "Lulzim" , "Durim" , "Shpetim" };
2625 List <String > expectedResult = Arrays .asList ("Afrim" , "Besim" , "Durim" );
2726 List <String > actualResult = StreamIndices .getEvenIndexedStrings (names );
2827
2928 assertEquals (expectedResult , actualResult );
3029 }
3130
3231 @ Test
33- public void givenArray_whenGetIndexedStrings_thenReturnListOfOddStrings () {
34- String [] names = { "Afrim" , "Bashkim" , "Besim" , "Lulzim" , "Durim" , "Shpetim" };
32+ public void whenCalled_thenReturnListOfOddStrings () {
33+ String [] names = {"Afrim" , "Bashkim" , "Besim" , "Lulzim" , "Durim" , "Shpetim" };
3534 List <String > expectedResult = Arrays .asList ("Bashkim" , "Lulzim" , "Shpetim" );
3635 List <String > actualResult = StreamIndices .getOddIndexedStrings (names );
3736
3837 assertEquals (expectedResult , actualResult );
3938 }
4039
4140 @ Test
42- public void givenList_whenGetIndexedStrings_thenReturnListOfEvenIndexedStrings () {
41+ public void givenList_whenCalled_thenReturnListOfEvenIndexedStrings () {
4342 List <String > names = Arrays .asList ("Afrim" , "Bashkim" , "Besim" , "Lulzim" , "Durim" , "Shpetim" );
44- List <Indexed <String >> expectedResult = Arrays .asList (Indexed .index (0 , "Afrim" ), Indexed .index (2 , "Besim" ), Indexed .index (4 , "Durim" ));
43+ List <Indexed <String >> expectedResult = Arrays
44+ .asList (Indexed .index (0 , "Afrim" ), Indexed .index (2 , "Besim" ), Indexed
45+ .index (4 , "Durim" ));
4546 List <Indexed <String >> actualResult = StreamIndices .getEvenIndexedStrings (names );
4647
4748 assertEquals (expectedResult , actualResult );
4849 }
4950
5051 @ Test
51- public void givenList_whenGetIndexedStrings_thenReturnListOfOddIndexedStrings () {
52+ public void givenList_whenCalled_thenReturnListOfOddIndexedStrings () {
5253 List <String > names = Arrays .asList ("Afrim" , "Bashkim" , "Besim" , "Lulzim" , "Durim" , "Shpetim" );
53- List <Indexed <String >> expectedResult = Arrays .asList (Indexed .index (1 , "Bashkim" ), Indexed .index (3 , "Lulzim" ), Indexed .index (5 , "Shpetim" ));
54+ List <Indexed <String >> expectedResult = Arrays
55+ .asList (Indexed .index (1 , "Bashkim" ), Indexed .index (3 , "Lulzim" ), Indexed
56+ .index (5 , "Shpetim" ));
5457 List <Indexed <String >> actualResult = StreamIndices .getOddIndexedStrings (names );
5558
5659 assertEquals (expectedResult , actualResult );
5760 }
5861
5962 @ Test
60- public void givenArray_whenGetIndexedStrings_thenReturnListOfOddStringsVersionTwo () {
61- String [] names = { "Afrim" , "Bashkim" , "Besim" , "Lulzim" , "Durim" , "Shpetim" };
63+ public void whenCalled_thenReturnListOfOddStringsVersionTwo () {
64+ String [] names = {"Afrim" , "Bashkim" , "Besim" , "Lulzim" , "Durim" , "Shpetim" };
6265 List <String > expectedResult = Arrays .asList ("Bashkim" , "Lulzim" , "Shpetim" );
6366 List <String > actualResult = StreamIndices .getOddIndexedStringsVersionTwo (names );
6467
6568 assertEquals (expectedResult , actualResult );
6669 }
67-
6870}
0 commit comments