diff --git a/src/test/java/org/example/AdministrationTest.java b/src/test/java/org/example/AdministrationTest.java index fcb0955..3e07fe7 100644 --- a/src/test/java/org/example/AdministrationTest.java +++ b/src/test/java/org/example/AdministrationTest.java @@ -107,7 +107,48 @@ class AdministrationTest { assertEquals("Jane Doe", result.getName(), "The name of the found admin should match."); } + @Test + void findAdminByIdTest() { + Administration administration = new Administration(); + Admin admin = new Admin("John Doe", "A2002", "Admin"); + administration.addAdmin(admin); + + Admin result = administration.findAdminById("A2002"); + assertNotNull(result, "Admin should be found by ID."); + assertEquals("A2002", result.getId(), "The ID should match the one searched for."); + } + + @Test + void addStudentTest() { + Administration administration = new Administration(); + Student student = new Student("Alice", "S1001", "Student"); + + // Initially, no student should be found + assertNull(administration.findStudentById("S1001")); + // Add the student + administration.addStudents(student); + + // Now, the student should be found + assertNotNull(administration.findStudentById("S1001")); + 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")); + } /** * Test case for the addCourse method.