|
|
@ -10,11 +10,15 @@ class AdministrationTest { |
|
|
|
private static final Course sampleCourse = new Course("Math", "M101", 4); |
|
|
|
private static final Student sampleStudent = new Student("Walter White", "S123456", "Student"); |
|
|
|
private static final Student sampleStudent2 = new Student("Jesse Pinkman", "S789012", "Student"); |
|
|
|
private static final Professor sampleProf = new Professor("P1001", "Aaron Levi", "Professor"); |
|
|
|
private static final Professor sampleProf2 = new Professor("P1002", "Diana Richter", "Professor"); |
|
|
|
private static final Admin sampleAdmin = new Admin("Saul Goodman", "A123456", "Admin"); |
|
|
|
private static final Admin sampleAdmin2 = new Admin("Mike Unknown", "A789012", "Admin"); |
|
|
|
|
|
|
|
// Test the findProfessorById Method |
|
|
|
@Test |
|
|
|
void findProfessorById() { |
|
|
|
Professor prof1 = new Professor("P1001", "Aaron", "Professor"); |
|
|
|
Professor prof1 = sampleProf; |
|
|
|
|
|
|
|
admin.addProfessor(prof1); |
|
|
|
|
|
|
@ -26,7 +30,7 @@ class AdministrationTest { |
|
|
|
@Test |
|
|
|
void deleteProfessor() { |
|
|
|
Administration administration = new Administration(); |
|
|
|
Professor professor = new Professor("P1002", "Diana", "Professor"); |
|
|
|
Professor professor = sampleProf2; |
|
|
|
|
|
|
|
administration.addProfessor(professor); |
|
|
|
assertTrue(administration.deleteProfessor("P1002")); |
|
|
@ -37,11 +41,11 @@ class AdministrationTest { |
|
|
|
void testAddProfessor() { |
|
|
|
Administration administration = new Administration(); |
|
|
|
|
|
|
|
Professor newProfessor = new Professor("P2001", "Dr. Jane Smith", "Professor"); |
|
|
|
Professor newProfessor = sampleProf2; |
|
|
|
|
|
|
|
administration.addProfessor(newProfessor); |
|
|
|
|
|
|
|
Professor retrievedProfessor = administration.findProfessorById("P2001"); |
|
|
|
Professor retrievedProfessor = administration.findProfessorById("P1002"); |
|
|
|
|
|
|
|
assertNotNull(retrievedProfessor, "Professor should be found in the administration."); |
|
|
|
assertEquals(newProfessor.getProfessorID(), retrievedProfessor.getProfessorID(), "The retrieved professor's ID should match the original."); |
|
|
@ -93,13 +97,9 @@ class AdministrationTest { |
|
|
|
*/ |
|
|
|
@Test |
|
|
|
void deleteAdmin() { |
|
|
|
// Create some sample admins |
|
|
|
Admin admin1 = new Admin("Saul Goodman", "A123456", "Admin"); |
|
|
|
Admin admin2 = new Admin("Mike Unknown", "A789012", "Admin"); |
|
|
|
|
|
|
|
// Add admins to the administration |
|
|
|
admin.addAdmin(admin1); |
|
|
|
admin.addAdmin(admin2); |
|
|
|
admin.addAdmin(sampleAdmin); |
|
|
|
admin.addAdmin(sampleAdmin2); |
|
|
|
|
|
|
|
// Attempt to delete an admin (admin1) |
|
|
|
boolean deleted = admin.deleteAdmin("A123456"); |
|
|
|