From 727be64c903f0b49d5f3169f731e1ac8f120410b Mon Sep 17 00:00:00 2001 From: fdai7887 Date: Thu, 8 Feb 2024 23:09:37 +0100 Subject: [PATCH] Added Test for deleteCourseWithInput method to AdministrationTest class --- .../java/org/example/AdministrationTest.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/test/java/org/example/AdministrationTest.java b/src/test/java/org/example/AdministrationTest.java index 8399712..75cbfc4 100644 --- a/src/test/java/org/example/AdministrationTest.java +++ b/src/test/java/org/example/AdministrationTest.java @@ -8,6 +8,7 @@ import java.io.ByteArrayOutputStream; import java.io.PrintStream; import java.util.List; import java.util.Map; +import java.util.Scanner; import static org.junit.jupiter.api.Assertions.*; @@ -514,6 +515,22 @@ class AdministrationTest { } + @Test + void deleteCourseWithInput(){ + Course course = sampleCourse; + admin.addCourse(course); + String courseIDToDelete = course.getCourseID(); + + boolean isDeleted = admin.deleteCourse(courseIDToDelete); + if (isDeleted) { + System.out.println("Course with ID " + courseIDToDelete + " has been successfully deleted."); + } else { + System.out.println("Course with ID " + courseIDToDelete + " not found."); + } + + assertEquals(0, admin.getCourses().size()); + } + }