|
@ -24,7 +24,7 @@ class CourseTest { |
|
|
* Verifies that the method correctly prints course information to the console. |
|
|
* Verifies that the method correctly prints course information to the console. |
|
|
*/ |
|
|
*/ |
|
|
@Test |
|
|
@Test |
|
|
void printCourseInfo() { |
|
|
|
|
|
|
|
|
void testPrintCourseInfo() { |
|
|
// Set up the expected output |
|
|
// Set up the expected output |
|
|
String expectedCourseName = "Course Name: Math"; |
|
|
String expectedCourseName = "Course Name: Math"; |
|
|
String expectedCourseCode = "Course Code: M101"; |
|
|
String expectedCourseCode = "Course Code: M101"; |
|
@ -58,7 +58,7 @@ class CourseTest { |
|
|
* Verifies that course data is correctly written to a file and can be read back. |
|
|
* Verifies that course data is correctly written to a file and can be read back. |
|
|
*/ |
|
|
*/ |
|
|
@Test |
|
|
@Test |
|
|
void writeToFile() { |
|
|
|
|
|
|
|
|
void testWriteToFile() { |
|
|
// Create a new course |
|
|
// Create a new course |
|
|
Course course = sampleCourse; |
|
|
Course course = sampleCourse; |
|
|
|
|
|
|
|
@ -84,7 +84,7 @@ class CourseTest { |
|
|
* Verifies that course data can be correctly read from a file. |
|
|
* Verifies that course data can be correctly read from a file. |
|
|
*/ |
|
|
*/ |
|
|
@Test |
|
|
@Test |
|
|
void readFromFile() { |
|
|
|
|
|
|
|
|
void testReadFromFile() { |
|
|
// Create a temporary file with sample course data |
|
|
// Create a temporary file with sample course data |
|
|
createTempFile("Math", "C101", "3", "Science", "C201", "4"); |
|
|
createTempFile("Math", "C101", "3", "Science", "C201", "4"); |
|
|
|
|
|
|
|
@ -109,7 +109,7 @@ class CourseTest { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Test |
|
|
@Test |
|
|
void addCourse() { |
|
|
|
|
|
|
|
|
void testAddCourse() { |
|
|
// Create a new course |
|
|
// Create a new course |
|
|
String courseName = sampleCourse.getCourseName(); |
|
|
String courseName = sampleCourse.getCourseName(); |
|
|
String courseCode = sampleCourse.getCourseID(); |
|
|
String courseCode = sampleCourse.getCourseID(); |
|
|