|
@ -10,11 +10,13 @@ class AdministrationTest { |
|
|
private static final Course sampleCourse = new Course("Math", "M101", 4); |
|
|
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 sampleStudent = new Student("Walter White", "S123456", "Student"); |
|
|
private static final Student sampleStudent2 = new Student("Jesse Pinkman", "S789012", "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"); |
|
|
|
|
|
|
|
|
// Test the findProfessorById Method |
|
|
// Test the findProfessorById Method |
|
|
@Test |
|
|
@Test |
|
|
void findProfessorById() { |
|
|
void findProfessorById() { |
|
|
Professor prof1 = new Professor("P1001", "Aaron", "Professor"); |
|
|
|
|
|
|
|
|
Professor prof1 = sampleProf; |
|
|
|
|
|
|
|
|
admin.addProfessor(prof1); |
|
|
admin.addProfessor(prof1); |
|
|
|
|
|
|
|
@ -26,7 +28,7 @@ class AdministrationTest { |
|
|
@Test |
|
|
@Test |
|
|
void deleteProfessor() { |
|
|
void deleteProfessor() { |
|
|
Administration administration = new Administration(); |
|
|
Administration administration = new Administration(); |
|
|
Professor professor = new Professor("P1002", "Diana", "Professor"); |
|
|
|
|
|
|
|
|
Professor professor = sampleProf2; |
|
|
|
|
|
|
|
|
administration.addProfessor(professor); |
|
|
administration.addProfessor(professor); |
|
|
assertTrue(administration.deleteProfessor("P1002")); |
|
|
assertTrue(administration.deleteProfessor("P1002")); |
|
@ -37,11 +39,11 @@ class AdministrationTest { |
|
|
void testAddProfessor() { |
|
|
void testAddProfessor() { |
|
|
Administration administration = new Administration(); |
|
|
Administration administration = new Administration(); |
|
|
|
|
|
|
|
|
Professor newProfessor = new Professor("P2001", "Dr. Jane Smith", "Professor"); |
|
|
|
|
|
|
|
|
Professor newProfessor = sampleProf2; |
|
|
|
|
|
|
|
|
administration.addProfessor(newProfessor); |
|
|
administration.addProfessor(newProfessor); |
|
|
|
|
|
|
|
|
Professor retrievedProfessor = administration.findProfessorById("P2001"); |
|
|
|
|
|
|
|
|
Professor retrievedProfessor = administration.findProfessorById("P1002"); |
|
|
|
|
|
|
|
|
assertNotNull(retrievedProfessor, "Professor should be found in the administration."); |
|
|
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.getProfessorID(), retrievedProfessor.getProfessorID(), "The retrieved professor's ID should match the original."); |
|
|