diff --git a/api/src/test/java/ca/bc/gov/educ/api/grad/report/service/CommonServiceTest.java b/api/src/test/java/ca/bc/gov/educ/api/grad/report/service/CommonServiceTest.java index d8b79adb..1d0e6cb6 100644 --- a/api/src/test/java/ca/bc/gov/educ/api/grad/report/service/CommonServiceTest.java +++ b/api/src/test/java/ca/bc/gov/educ/api/grad/report/service/CommonServiceTest.java @@ -1706,12 +1706,92 @@ public void testGetStudentIDsByStudentGuidsAndReportType() { UUID uuid = UUID.randomUUID(); Pageable paging = PageRequest.of(0, 1); - Mockito.when(gradStudentReportsRepository.getReportStudentIDsByStudentIDsAndReportType(List.of(uuid), "reportType", paging)).thenReturn(Page.empty()); - List result = commonService.getStudentIDsByStudentGuidsAndReportType(List.of(uuid.toString()), "reportType", 100); - assertThat(result).isNotNull().isEmpty(); + Mockito.when(gradStudentReportsRepository.getReportStudentIDsByStudentIDsAndReportType(List.of(uuid), "reportType", paging)).thenReturn(new Page() { + @Override + public Iterator iterator() { + return getContent().listIterator(); + } + + @Override + public int getNumber() { + return 1; + } + + @Override + public int getSize() { + return 1; + } + + @Override + public int getNumberOfElements() { + return 1; + } + + @Override + public List getContent() { + return List.of(uuid); + } + + @Override + public boolean hasContent() { + return !getContent().isEmpty(); + } + + @Override + public Sort getSort() { + return null; + } + + @Override + public boolean isFirst() { + return false; + } + + @Override + public boolean isLast() { + return false; + } + + @Override + public boolean hasNext() { + return false; + } + + @Override + public boolean hasPrevious() { + return false; + } + + @Override + public Pageable nextPageable() { + return null; + } + + @Override + public Pageable previousPageable() { + return null; + } + + @Override + public int getTotalPages() { + return getContent().size(); + } + + @Override + public long getTotalElements() { + return getContent().size(); + } + + @Override + public Page map(Function converter) { + return null; + } + }); + List result = commonService.getStudentIDsByStudentGuidsAndReportType(List.of(uuid.toString()), "reportType", 1); + assertThat(result).isNotNull().isNotEmpty(); Mockito.when(gradStudentReportsRepository.findStudentIDByGradReportTypeCode("reportType", paging)).thenReturn(Page.empty()); - result = commonService.getStudentIDsByStudentGuidsAndReportType(List.of(), "reportType", 100); + result = commonService.getStudentIDsByStudentGuidsAndReportType(List.of(), "reportType", 1); assertThat(result).isNotNull().isEmpty(); }