Browse Source

Test: AddProfessor Test added

remotes/origin/fdai7780
fdai7600 11 months ago
parent
commit
73a429764b
  1. 14
      src/test/java/org/example/AdministrationTest.java

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

@ -17,8 +17,22 @@ class AdministrationTest {
Professor foundProf1 = administration.findProfessorById("P1001"); Professor foundProf1 = administration.findProfessorById("P1001");
assertEquals(prof1, foundProf1); assertEquals(prof1, foundProf1);
}
@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

Loading…
Cancel
Save