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