Browse Source

test: deleteCourse method in Administration class

remotes/origin/fdai7780
fdai7921 11 months ago
parent
commit
5d8f186caa
  1. 15
      src/test/java/org/example/AdministrationTest.java

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

@ -79,4 +79,19 @@ class AdministrationTest {
admin.addCourse(course); admin.addCourse(course);
assertEquals(course, admin.findCourseByID("M101")); assertEquals(course, admin.findCourseByID("M101"));
} }
@Test
public void testDeleteCourse() {
Administration administration = new Administration();
// Adding a course
Course course = new Course("Math", "M101", 4);
administration.addCourse(course);
// Deleting the course
assertTrue(administration.deleteCourse("M101"));
// Checking if the course is no longer found
assertNull(administration.findCourseByID("M101"));
}
} }
Loading…
Cancel
Save