From 84826cfa7dbc649d4e48656274267740e6dcb971 Mon Sep 17 00:00:00 2001 From: fdai7600 Date: Wed, 7 Feb 2024 16:13:15 +0100 Subject: [PATCH] Test: deleteStudentTest Test added --- .../java/org/example/AdministrationTest.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/test/java/org/example/AdministrationTest.java b/src/test/java/org/example/AdministrationTest.java index 9e2fe17..2f744e2 100644 --- a/src/test/java/org/example/AdministrationTest.java +++ b/src/test/java/org/example/AdministrationTest.java @@ -135,4 +135,20 @@ class AdministrationTest { assertEquals("Alice", administration.findStudentById("S1001").getName()); } + @Test + void deleteStudentTest() { + Administration administration = new Administration(); + Student student = new Student("Bob", "S1002", "Student"); + + // Add the student and verify they're added + administration.addStudents(student); + assertNotNull(administration.findStudentById("S1002")); + + // Delete the student + assertTrue(administration.deleteStudents("S1002")); + + // Verify the student is no longer found + assertNull(administration.findStudentById("S1002")); + } + } \ No newline at end of file