From 6ca8101ffee73f04953d2a695c83fc809e0fbd08 Mon Sep 17 00:00:00 2001 From: fdai7887 Date: Thu, 8 Feb 2024 22:15:14 +0100 Subject: [PATCH] Added Test for dropStudentFromCourse method to AdministrationTest class --- .../java/org/example/AdministrationTest.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/test/java/org/example/AdministrationTest.java b/src/test/java/org/example/AdministrationTest.java index 0397e89..414404f 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,22 @@ class AdministrationTest { assertEquals("Student",administration.findStudentById("S1010").getStudentRole()); } + @Test + void dropStudentFromCourse() { + Student student = sampleStudent; + Course course = sampleCourse; + admin.addStudents(student); + admin.addCourse(course); + + Map studentCourses = student.getCourseGrades(); + studentCourses.put(course, "Not Graded"); + student.setCourseGrades(studentCourses); + + assertEquals(1, student.courseGrades.size()); + + admin.dropStudentFromCourse("S123456", "M101"); + + assertEquals(0, student.courseGrades.size()); + + } }