From ba5399d67502a26cab0837e57f8ea18f004a7fd7 Mon Sep 17 00:00:00 2001 From: fdai7600 Date: Wed, 7 Feb 2024 15:58:46 +0100 Subject: [PATCH] Test: AddAdmin Test added --- .../java/org/example/AdministrationTest.java | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/test/java/org/example/AdministrationTest.java b/src/test/java/org/example/AdministrationTest.java index fdff1bb..6ec59c3 100644 --- a/src/test/java/org/example/AdministrationTest.java +++ b/src/test/java/org/example/AdministrationTest.java @@ -19,6 +19,16 @@ class AdministrationTest { } + @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(); @@ -85,15 +95,19 @@ class AdministrationTest { Student student2 = administration.findStudentById("S1001"); assertEquals(student, student2); } - @Test - void deleteProfessor() { + void addAdminTest() { Administration administration = new Administration(); - Professor professor = new Professor("P1002", "Diana", "Professor"); - administration.addProfessor(professor); - assertTrue(administration.deleteProfessor("P1002")); - assertNull(administration.findProfessorById("P1002")); + 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."); } + + } \ No newline at end of file