Witam, mam kłopot zw teście,
wygląda to tak :
@Test
public void testWhenUserAmountEqualsHoundred(){
//Given
Statistics statisticsMock = mock(Statistics.class);
when(statisticsMock.postsCount()).thenReturn(0);
when(statisticsMock.commentsCount()).thenReturn(3);
when(statisticsMock.userNames()).thenReturn(new ArrayList<>(for(int i=0; i <= 100; i++)));
//When
StatisticsCount statisticsCount = new StatisticsCount();
statisticsCount.calculateAdvStatistics(statisticsMock);
//Then
Assert.assertEquals(100,statisticsCount.getUserQuantity());
}
}
Chodzi o ArrayListę, jak mogę tam coś dodać przy pomocą pętli?(//Given ostatnia linijka)
Pozdrawiam