From d96374f5a0cc74d1198bb14f2aa5ba901c6b7b91 Mon Sep 17 00:00:00 2001 From: arybakov Date: Wed, 28 Aug 2024 10:31:38 -0600 Subject: [PATCH] GRAD2-2817 TVR Delete Process - Backend Changes Endpoints --- .../report/service/CommonServiceTest.java | 88 ++++++++++++++++++- 1 file changed, 84 insertions(+), 4 deletions(-) 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(); }