@Test
public void testGetComments_getFirstPage() {
int page = 0;
int pageSize = 20;
List<CaseComment> commentList = new ArrayList<>();
for (int i = 0; i < 35; i++) {
CaseComment caseComment = createTestComment();
commentList.add(caseComment);
}
when(clientMock.getComments(containerId, caseId, page, pageSize)).thenReturn(commentList);
final List<CaseCommentSummary> commentsFromService = testedService.getComments(serverTemplateId, containerId, caseId, page, pageSize);
assertNotNull(commentsFromService);
assertEquals(20, commentsFromService.size());
}
@Test
public void testGetComments_getSecondPage() {
int page = 1;
int pageSize = 20;
List<CaseComment> commentList = new ArrayList<>();
for (int i = 0; i < 35; i++) {
CaseComment caseComment = createTestComment();
commentList.add(caseComment);
}
when(clientMock.getComments(containerId, caseId, page, pageSize)).thenReturn(commentList);
final List<CaseCommentSummary> commentsFromService = testedService.getComments(serverTemplateId, containerId, caseId, page, pageSize);
assertNotNull(commentsFromService);
assertEquals(15, commentsFromService.size());
}