diff --git a/api/src/test/java/ca/bc/gov/educ/api/grad/report/controller/CommonControllerTest.java b/api/src/test/java/ca/bc/gov/educ/api/grad/report/controller/CommonControllerTest.java index 9aaad36a..521a1b58 100644 --- a/api/src/test/java/ca/bc/gov/educ/api/grad/report/controller/CommonControllerTest.java +++ b/api/src/test/java/ca/bc/gov/educ/api/grad/report/controller/CommonControllerTest.java @@ -56,9 +56,15 @@ public void testGetStudentCertificate() { public void testGetReportsCount() { // ID String mincode = "123456789"; + String guid = UUID.randomUUID().toString(); + Mockito.when(commonService.countBySchoolOfRecordsAndReportType(List.of(mincode), "reportType")).thenReturn(1); commonController.getReportsCount("reportType", List.of(mincode)); Mockito.verify(commonService).countBySchoolOfRecordsAndReportType(List.of(mincode), "reportType"); + + Mockito.when(commonService.countByStudentGuidsAndReportType(List.of(guid), "ACHV")).thenReturn(1); + commonController.getReportsCount("ACHV", List.of(guid)); + Mockito.verify(commonService).countByStudentGuidsAndReportType(List.of(guid), "ACHV"); } @Test 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 31fc97d0..1a055aa4 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 @@ -1688,6 +1688,19 @@ public void testCountBySchoolOfRecordsAndReportType() { assertThat(count).isNotNull().isEqualTo(1); } + @Test + public void testCountByStudentGuidsAndReportType() { + + UUID uuid = UUID.randomUUID(); + Mockito.when(gradStudentReportsRepository.countByStudentGuidsAndReportType(List.of(uuid), "reportType")).thenReturn(1); + Integer count = commonService.countByStudentGuidsAndReportType(List.of(uuid.toString()), "reportType"); + assertThat(count).isNotNull().isEqualTo(1); + + Mockito.when(gradStudentReportsRepository.countByReportType("reportType")).thenReturn(1); + count = commonService.countByStudentGuidsAndReportType(List.of(), "reportType"); + assertThat(count).isNotNull().isEqualTo(1); + } + @Test public void testArchiveSchoolReports() { Mockito.when(schoolReportsRepository.deleteSchoolReports(List.of("12345678"), "reportTypeARC".toUpperCase())).thenReturn(1);