diff --git a/src/test/java/org/example/AdministrationTest.java b/src/test/java/org/example/AdministrationTest.java index eef7af4..6b2e3f7 100644 --- a/src/test/java/org/example/AdministrationTest.java +++ b/src/test/java/org/example/AdministrationTest.java @@ -71,6 +71,32 @@ class AdministrationTest { assertEquals(student, student2); } + @Test + void addStudents() { + Administration admin = new Administration(); + + // Creating a sample student + Student student = new Student("Walter White", "S123456", "Student"); + + // Adding the student to the system + admin.addStudents(student); + + // Retrieving the added student by ID + Student retrievedStudent = admin.findStudentById("S123456"); + + // Asserting that the retrieved student is not null + assertNotNull(retrievedStudent); + + // Asserting that the retrieved student's name matches the expected name + assertEquals("Walter White", retrievedStudent.getName()); + + // Asserting that the retrieved student's ID matches the expected ID + assertEquals("S123456", retrievedStudent.getId()); + + // Asserting that the retrieved student's role matches the expected role + assertEquals("Student", retrievedStudent.getRole()); + } + @Test void deleteStudents() { Student student1 = new Student("Walter White", "S123456", "Student"); @@ -140,5 +166,4 @@ class AdministrationTest { // Finding the added course assertEquals(course, admin.findCourseByID("M101")); } - } \ No newline at end of file