Browse Source

refactoring: extracting sampleAdmins in AdministrationTest file

remotes/origin/fdai7780
fdai7921 11 months ago
parent
commit
4c54c416ff
  1. 10
      src/test/java/org/example/AdministrationTest.java

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

@ -12,6 +12,8 @@ class AdministrationTest {
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 sampleProf = new Professor("P1001", "Aaron Levi", "Professor");
private static final Professor sampleProf2 = new Professor("P1002", "Diana Richter", "Professor"); private static final Professor sampleProf2 = new Professor("P1002", "Diana Richter", "Professor");
private static final Admin sampleAdmin = new Admin("Saul Goodman", "A123456", "Admin");
private static final Admin sampleAdmin2 = new Admin("Mike Unknown", "A789012", "Admin");
// Test the findProfessorById Method // Test the findProfessorById Method
@Test @Test
@ -95,13 +97,9 @@ class AdministrationTest {
*/ */
@Test @Test
void deleteAdmin() { void deleteAdmin() {
// Create some sample admins
Admin admin1 = new Admin("Saul Goodman", "A123456", "Admin");
Admin admin2 = new Admin("Mike Unknown", "A789012", "Admin");
// Add admins to the administration // Add admins to the administration
admin.addAdmin(admin1);
admin.addAdmin(admin2);
admin.addAdmin(sampleAdmin);
admin.addAdmin(sampleAdmin2);
// Attempt to delete an admin (admin1) // Attempt to delete an admin (admin1)
boolean deleted = admin.deleteAdmin("A123456"); boolean deleted = admin.deleteAdmin("A123456");

Loading…
Cancel
Save