From 98fc1b6c52a097110c887a0a06a0dc9247e4ddc6 Mon Sep 17 00:00:00 2001 From: fdai7600 Date: Fri, 9 Feb 2024 00:05:48 +0100 Subject: [PATCH] Test: added testStudentPasses() --- src/test/java/org/example/StudentTest.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/test/java/org/example/StudentTest.java b/src/test/java/org/example/StudentTest.java index bba66d2..7dd085d 100644 --- a/src/test/java/org/example/StudentTest.java +++ b/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."); } + @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."); + } + } \ No newline at end of file