From bedd3bf1d63086d9f3fb228f43e0268dea88bbe6 Mon Sep 17 00:00:00 2001 From: Kamal Mohammed Date: Mon, 4 Mar 2024 10:42:33 -0700 Subject: [PATCH] GRAD2-2465 - Delete a student and related data --- .../api/trax/service/TraxCommonServiceTest.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/api/src/test/java/ca/bc/gov/educ/api/trax/service/TraxCommonServiceTest.java b/api/src/test/java/ca/bc/gov/educ/api/trax/service/TraxCommonServiceTest.java index 5435d6af..76346be2 100644 --- a/api/src/test/java/ca/bc/gov/educ/api/trax/service/TraxCommonServiceTest.java +++ b/api/src/test/java/ca/bc/gov/educ/api/trax/service/TraxCommonServiceTest.java @@ -677,6 +677,23 @@ public void testSaveTraxStudentNo() { assertThat(traxStudentNo.getStatus()).isEqualTo(result.getStatus()); } + @Test + public void updateSaveTraxStudentNo() { + TraxStudentNo traxStudentNo = new TraxStudentNo(); + traxStudentNo.setStudNo("123456789"); + traxStudentNo.setStatus("Y"); + + TraxStudentNoEntity traxStudentNoEntity = traxStudentNoTransformer.transformToEntity(traxStudentNo); + + when(traxStudentNoRepository.findById(traxStudentNo.getStudNo())).thenReturn(Optional.of(traxStudentNoEntity)); + when(traxStudentNoRepository.save(traxStudentNoEntity)).thenReturn(traxStudentNoEntity); + + var result = traxCommonService.updateTraxStudentNo(traxStudentNo.getStudNo()); + assertThat(result).isNotNull(); + assertThat(traxStudentNo.getStudNo()).isEqualTo(result.getStudNo()); + assertThat(traxStudentNo.getStatus()).isEqualTo(result.getStatus()); + } + // @Test // public void testStudentIsNotGraduated() { // // Student is graduated or not