From 5d8f186caad214ef12376dd4914fde1847f502b0 Mon Sep 17 00:00:00 2001 From: fdai7921 Date: Wed, 7 Feb 2024 15:48:53 +0100 Subject: [PATCH] test: deleteCourse method in Administration class --- src/test/java/org/example/AdministrationTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/test/java/org/example/AdministrationTest.java b/src/test/java/org/example/AdministrationTest.java index e4ac41f..20e879b 100644 --- a/src/test/java/org/example/AdministrationTest.java +++ b/src/test/java/org/example/AdministrationTest.java @@ -79,4 +79,19 @@ class AdministrationTest { admin.addCourse(course); 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")); + } + } \ No newline at end of file