From 41fbbca3b90c59c892bc869b30fc8e5812faf5d9 Mon Sep 17 00:00:00 2001 From: githubmamatha Date: Mon, 13 Jan 2025 10:32:29 -0800 Subject: [PATCH] test case coverage 2 --- .../EducGradBusinessApiApplicationTests.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/api/src/test/java/ca/bc/gov/educ/api/gradbusiness/EducGradBusinessApiApplicationTests.java b/api/src/test/java/ca/bc/gov/educ/api/gradbusiness/EducGradBusinessApiApplicationTests.java index 543d7c4..d1cf1b8 100644 --- a/api/src/test/java/ca/bc/gov/educ/api/gradbusiness/EducGradBusinessApiApplicationTests.java +++ b/api/src/test/java/ca/bc/gov/educ/api/gradbusiness/EducGradBusinessApiApplicationTests.java @@ -286,7 +286,7 @@ void testSchoolReportPDFByMincode() throws Exception { } @Test - void testgetAmalgamatedSchoolReportPDFByMincode() throws Exception { + void testAmalgamatedSchoolReportPDFByMincode() throws Exception { String mincode = "128385861"; String type = "TVRNONGRAD"; @@ -311,6 +311,19 @@ void testgetAmalgamatedSchoolReportPDFByMincode() throws Exception { assertEquals(HttpStatus.NO_CONTENT, byteData.getStatusCode()); } + @Test + void testAmalgamatedSchoolReportPDFByMincode_NotFound() { + + String mincode = "128385861"; + String type = "TVRNONGRAD"; + String schoolOfRecordId = "14453395-ecf0-7f81-998f-506940d94c2d"; + + when(this.restService.get(String.format(educGradStudentApiConstants.getStudentsForAmalgamatedReport(), schoolOfRecordId, type), List.class)).thenThrow(new RuntimeException()); + + ResponseEntity byteData = gradBusinessService.getSchoolReportPDFByMincode(mincode, type); + assertNotNull(byteData); + assertEquals(HttpStatus.NOT_FOUND, byteData.getStatusCode()); + } @Test void testSchoolReportPDFByMincode_NotFound() {