Skip to content

Commit

Permalink
GRAD2-2465 - Delete a student and related data
Browse files Browse the repository at this point in the history
  • Loading branch information
kamal-mohammed committed Mar 7, 2024
1 parent c161f81 commit 59b9e5b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public Student getStudentByPen(String pen, String accessToken) {
}

@Transactional
public void cascadeDeleteStudent(String pen, String accessToken) {
public String cascadeDeleteStudent(String pen, String accessToken) {
logger.debug("Cascade Delete a Student [Service]");

//GET Student by PEN
Expand All @@ -76,5 +76,6 @@ Delete All student related data ({STUDENT_API}/api/v1/student/conv/studentid/{st
*/
restUtils.removeAllStudentRelatedData(UUID.fromString(studentID), accessToken);
}
return pen;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ public class StudentControllerTest {

@Test
public void testGetGradStudentByPenFromStudentAPI() {
// ID
UUID studentID = UUID.randomUUID();

String pen = "123456789";
String accessToken = "Bearer accesstoken";
Expand All @@ -40,4 +38,18 @@ public void testGetGradStudentByPenFromStudentAPI() {
Mockito.verify(studentService).getStudentByPen(pen, accessToken.replaceAll("Bearer ", accessToken));

}

@Test
public void testCascadeDeleteStudent() {

String pen = "123456789";
String accessToken = "Bearer accesstoken";

Student student = new Student();

Mockito.when(studentService.cascadeDeleteStudent(pen, accessToken.replaceAll("Bearer ", accessToken))).thenReturn(pen);
studentService.cascadeDeleteStudent(pen,accessToken.replaceAll("Bearer ", accessToken));
Mockito.verify(studentService).cascadeDeleteStudent(pen, accessToken.replaceAll("Bearer ", accessToken));

}
}

0 comments on commit 59b9e5b

Please sign in to comment.