Browse Source

Merge remote-tracking branch 'origin/fdai7600'

remotes/origin/fdai7780
fdai7600 11 months ago
parent
commit
7d78c3edbd
  1. 38
      src/test/java/org/example/AdministrationTest.java

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

@ -19,8 +19,32 @@ class AdministrationTest {
Professor foundProf1 = admin.findProfessorById("P1001");
assertEquals(prof1, foundProf1);
}
@Test
void deleteProfessor() {
Administration administration = new Administration();
Professor professor = new Professor("P1002", "Diana", "Professor");
administration.addProfessor(professor);
assertTrue(administration.deleteProfessor("P1002"));
assertNull(administration.findProfessorById("P1002"));
}
@Test
void testAddProfessor() {
Administration administration = new Administration();
Professor newProfessor = new Professor("P2001", "Dr. Jane Smith", "Professor");
administration.addProfessor(newProfessor);
Professor retrievedProfessor = administration.findProfessorById("P2001");
assertNotNull(retrievedProfessor, "Professor should be found in the administration.");
assertEquals(newProfessor.getProfessorID(), retrievedProfessor.getProfessorID(), "The retrieved professor's ID should match the original.");
assertEquals(newProfessor.getName(), retrievedProfessor.getName(), "The retrieved professor's name should match the original.");
assertEquals(newProfessor.getRole(), retrievedProfessor.getRole(), "The retrieved professor's role should match the original.");
}
@Test
@ -70,6 +94,20 @@ class AdministrationTest {
Student student2 = admin.findStudentById("S1001");
assertEquals(student, student2);
}
@Test
void addAdminTest() {
Administration administration = new Administration();
Admin admin = new Admin("Jane Doe", "A2001", "Admin");
administration.addAdmin(admin);
Admin result = administration.findAdminById("A2001");
assertNotNull(result, "Admin should be found after being added.");
assertEquals("A2001", result.getId(), "The ID of the found admin should match.");
assertEquals("Jane Doe", result.getName(), "The name of the found admin should match.");
}
/**
* Test case for the addCourse method.

Loading…
Cancel
Save