Browse Source

refactoring: extract sampleCourse in AdministrationTest file

remotes/origin/fdai7780
fdai7921 11 months ago
parent
commit
fc6f04db7b
  1. 8
      src/test/java/org/example/AdministrationTest.java

8
src/test/java/org/example/AdministrationTest.java

@ -6,6 +6,8 @@ import static org.junit.jupiter.api.Assertions.*;
class AdministrationTest {
private static final Course sampleCourse = new Course("Math", "M101", 4);
// Test the findProfessorById Method
@Test
void findProfessorById() {
@ -79,7 +81,7 @@ class AdministrationTest {
@Test
void addCourse() {
Administration admin = new Administration();
Course course = new Course("Math", "M101", 4);
Course course = sampleCourse;
admin.addCourse(course);
assertEquals(course, admin.findCourseByID("M101"));
}
@ -92,7 +94,7 @@ class AdministrationTest {
public void testDeleteCourse() {
Administration administration = new Administration();
// Adding a course
Course course = new Course("Math", "M101", 4);
Course course = sampleCourse;
administration.addCourse(course);
// Deleting the course
@ -110,7 +112,7 @@ class AdministrationTest {
public void testFindCourseByID() {
Administration administration = new Administration();
// Adding a course
Course course = new Course("Math", "M101", 4);
Course course = sampleCourse;
administration.addCourse(course);
// Finding the added course

Loading…
Cancel
Save