Browse Source

Added test for calculateTotalCredits Method in StudentTest class

remotes/origin/fdai7887
fdai7887 11 months ago
parent
commit
614e31e845
  1. 15
      src/test/java/org/example/StudentTest.java

15
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."); 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);
}
} }
Loading…
Cancel
Save