From 6f0cddc9f2de84cc63a303b4338e8ba001da634e Mon Sep 17 00:00:00 2001 From: fdai7600 Date: Fri, 9 Feb 2024 00:06:59 +0100 Subject: [PATCH] Test: added testStudentFails() --- src/test/java/org/example/StudentTest.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/test/java/org/example/StudentTest.java b/src/test/java/org/example/StudentTest.java index 7dd085d..28b48b6 100644 --- a/src/test/java/org/example/StudentTest.java +++ b/src/test/java/org/example/StudentTest.java @@ -146,4 +146,14 @@ class StudentTest { assertTrue(student.hasPassed(), "Student should have passed."); } + @Test + void testStudentFails() { + Student student = new Student("Jane Doe", "S1002", "Student"); + Course history = new Course("History", "C103", 5); // Assuming 5 credits + Course biology = new Course("Biology", "C104", 5); // Assuming 5 credits + student.assignGrade(history, "8"); // Assuming grade is a String. Adjust if it's numeric. + student.assignGrade(biology, "9"); + + assertFalse(student.hasPassed(), "Student should have failed."); + } } \ No newline at end of file