Browse Source

Test: added testStudentPasses()

remotes/origin/fdai7600
fdai7600 11 months ago
parent
commit
98fc1b6c52
  1. 11
      src/test/java/org/example/StudentTest.java

11
src/test/java/org/example/StudentTest.java

@ -135,4 +135,15 @@ class StudentTest {
assertEquals(expectedAverage, student.calculateAverageGrade(), 0.01, "The calculated average grade is incorrect."); assertEquals(expectedAverage, student.calculateAverageGrade(), 0.01, "The calculated average grade is incorrect.");
} }
@Test
void testStudentPasses() {
Student student = new Student("John Doe", "S1001", "Student");
Course math = new Course("Math", "C101", 5); // Assuming 5 credits
Course physics = new Course("Physics", "C102", 5); // Assuming 5 credits
student.assignGrade(math, "15"); // Assuming grade is a String. Adjust if it's numeric.
student.assignGrade(physics, "10");
assertTrue(student.hasPassed(), "Student should have passed.");
}
} }
Loading…
Cancel
Save