From f4db111d22f69aaf456f319bccc6383df5900a7a Mon Sep 17 00:00:00 2001 From: fdai7921 Date: Wed, 7 Feb 2024 16:28:13 +0100 Subject: [PATCH] refactoring: extracting sampleStudents in AdministrationTest file --- src/test/java/org/example/AdministrationTest.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/test/java/org/example/AdministrationTest.java b/src/test/java/org/example/AdministrationTest.java index 4eec884..ad18cd2 100644 --- a/src/test/java/org/example/AdministrationTest.java +++ b/src/test/java/org/example/AdministrationTest.java @@ -8,6 +8,8 @@ class AdministrationTest { Administration admin = new Administration(); private static final Course sampleCourse = new Course("Math", "M101", 4); + private static final Student sampleStudent = new Student("Walter White", "S123456", "Student"); + private static final Student sampleStudent2 = new Student("Jesse Pinkman", "S789012", "Student"); // Test the findProfessorById Method @Test @@ -112,7 +114,7 @@ class AdministrationTest { @Test void addStudents() { // Creating a sample student - Student student = new Student("Walter White", "S123456", "Student"); + Student student = sampleStudent; // Adding the student to the system admin.addStudents(student); @@ -139,8 +141,8 @@ class AdministrationTest { */ @Test void deleteStudents() { - Student student1 = new Student("Walter White", "S123456", "Student"); - Student student2 = new Student("Jesse Pinkmann", "S789012", "Student"); + Student student1 = sampleStudent; + Student student2 = sampleStudent2; // Add students to the administration admin.addStudents(student1);