|
@ -19,8 +19,32 @@ class AdministrationTest { |
|
|
Professor foundProf1 = admin.findProfessorById("P1001"); |
|
|
Professor foundProf1 = admin.findProfessorById("P1001"); |
|
|
assertEquals(prof1, foundProf1); |
|
|
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 |
|
|
@Test |
|
@ -70,6 +94,20 @@ class AdministrationTest { |
|
|
Student student2 = admin.findStudentById("S1001"); |
|
|
Student student2 = admin.findStudentById("S1001"); |
|
|
assertEquals(student, student2); |
|
|
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. |
|
|
* Test case for the addCourse method. |
|
|