diff --git a/src/test/java/org/example/StudentTest.java b/src/test/java/org/example/StudentTest.java index 6e2abaf..30231f2 100644 --- a/src/test/java/org/example/StudentTest.java +++ b/src/test/java/org/example/StudentTest.java @@ -108,4 +108,19 @@ class StudentTest { assertEquals(newGrade, student.getCourseGrades().get(course), "Grade update for course does not match expected new grade."); } + @Test + void calculateTotalCredits(){ + Administration admin = new Administration(); + Student student = new Student("John Doe", "S1001", "Student"); + Course course = new Course("Introduction to Java", "C101", 3); + admin.addStudents(student); + admin.addCourse(course); + admin.enrollStudentInCourse("S1001", "C101"); + + int credits = student.calculateTotalCredits(); + + assertEquals(3,credits); + + } + } \ No newline at end of file