From 1c02ddb4eef10692a94c8894f07b1a2b76cb2949 Mon Sep 17 00:00:00 2001 From: fdai7600 Date: Wed, 7 Feb 2024 16:12:32 +0100 Subject: [PATCH] Test: addStudentTest Test added --- .../java/org/example/AdministrationTest.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/test/java/org/example/AdministrationTest.java b/src/test/java/org/example/AdministrationTest.java index 1eb2203..9e2fe17 100644 --- a/src/test/java/org/example/AdministrationTest.java +++ b/src/test/java/org/example/AdministrationTest.java @@ -119,4 +119,20 @@ class AdministrationTest { assertEquals("A2002", result.getId(), "The ID should match the one searched for."); } + @Test + void addStudentTest() { + Administration administration = new Administration(); + Student student = new Student("Alice", "S1001", "Student"); + + // Initially, no student should be found + assertNull(administration.findStudentById("S1001")); + + // Add the student + administration.addStudents(student); + + // Now, the student should be found + assertNotNull(administration.findStudentById("S1001")); + assertEquals("Alice", administration.findStudentById("S1001").getName()); + } + } \ No newline at end of file