diff --git a/src/test/java/org/example/AdministrationTest.java b/src/test/java/org/example/AdministrationTest.java index 0397e89..f376603 100644 --- a/src/test/java/org/example/AdministrationTest.java +++ b/src/test/java/org/example/AdministrationTest.java @@ -3,6 +3,7 @@ package org.example; import org.junit.jupiter.api.Test; import java.util.List; +import java.util.Map; import static org.junit.jupiter.api.Assertions.*; @@ -418,4 +419,32 @@ class AdministrationTest { assertEquals("Student",administration.findStudentById("S1010").getStudentRole()); } + + @Test + void testEnrollStudentInCourseInteractive() { + Administration administration = new Administration(); + + Student stud = sampleStudent; + administration.addStudents(stud); + Course course = sampleCourse; + administration.addCourse(course); + String studentId =stud.getStudentId(); // Use nextLine for consistent input handling + String courseId = course.getCourseID(); + + boolean enrolled = administration.enrollStudentInCourse(studentId, courseId); + + boolean correct = false; + Map courses = stud.getCourseGrades(); + + for(Course key : courses.keySet()) + { + if(key == course) + { + correct = true; + break; + } + } + + assertTrue(correct); + } }