Browse Source

Test: deleteStudentTest Test added

remotes/origin/fdai7780
fdai7600 11 months ago
parent
commit
84826cfa7d
  1. 16
      src/test/java/org/example/AdministrationTest.java

16
src/test/java/org/example/AdministrationTest.java

@ -135,4 +135,20 @@ class AdministrationTest {
assertEquals("Alice", administration.findStudentById("S1001").getName()); 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"));
}
} }
Loading…
Cancel
Save