From 38977b1f093b1c9b558029aee77b4b5fce56cc8f Mon Sep 17 00:00:00 2001 From: fdai7887 Date: Thu, 8 Feb 2024 20:37:07 +0100 Subject: [PATCH 1/2] Added test for dropFromCourse Method in AdministrationTest class --- .../java/org/example/AdministrationTest.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/test/java/org/example/AdministrationTest.java b/src/test/java/org/example/AdministrationTest.java index 647c024..0397e89 100644 --- a/src/test/java/org/example/AdministrationTest.java +++ b/src/test/java/org/example/AdministrationTest.java @@ -324,6 +324,33 @@ class AdministrationTest { } + + @Test + void dropProfFromCourse(){ + Professor prof = sampleProf; + Course course = sampleCourse; + List courseList = prof.getCoursesTaught(); + courseList.add(course); + prof.setCoursesTaught(courseList); + + //The "User input" to determine the professor + String profID = prof.getProfessorID(); + + //Grabs the coursesTaught List from the Professor the user wants to enroll + List courseList2 = prof.getCoursesTaught(); + //Assigning the course to the Prof by adding it the to the courseList + courseList2.remove(course); + //The Professor gets the updated courseList + prof.setCoursesTaught(courseList); + + + //Checks if the course got removed + assertEquals(0,prof.getCoursesTaught().size() ); + + } + + + @Test void registerUser() { Administration administration = new Administration(); From bf2260f2b7919bb7b66e8b00b0ef81fd1afaa609 Mon Sep 17 00:00:00 2001 From: fdai7887 Date: Thu, 8 Feb 2024 20:51:52 +0100 Subject: [PATCH 2/2] refactoring: removed redundancies from Menu in Main class --- src/main/java/org/example/Main.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/main/java/org/example/Main.java b/src/main/java/org/example/Main.java index a5ebe9f..3c59a3c 100644 --- a/src/main/java/org/example/Main.java +++ b/src/main/java/org/example/Main.java @@ -72,15 +72,9 @@ public class Main { // View Grades from Student break; case 11: - // View User - break; - case 12: // Delete User break; - case 13: - // View Course List - break; - case 14: + case 12: // Exit (includes saving data in the files) exit = true; System.out.println("Exiting...");