|
|
@ -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")); |
|
|
|
} |
|
|
|
|
|
|
|
} |