|
|
@ -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); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |