Browse Source

Test: addStudentTest Test added

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

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

@ -119,4 +119,20 @@ class AdministrationTest {
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());
}
}
Loading…
Cancel
Save