diff --git a/src/test/java/org/example/ProfessorTest.java b/src/test/java/org/example/ProfessorTest.java index ab52603..002f461 100644 --- a/src/test/java/org/example/ProfessorTest.java +++ b/src/test/java/org/example/ProfessorTest.java @@ -1,4 +1,24 @@ package org.example; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.util.List; + +import static org.junit.Assert.assertEquals; + public class ProfessorTest { + + @Test + void testReadFromFile() throws IOException { + Professor professor = new Professor("P1002", "Jane Doe", "Professor"); + professor.writeToFile(); + + List professors = Professor.readFromFile(); + + assertEquals(1, professors.size()); + assertEquals("P1002", professors.get(0).getProfessorID()); + assertEquals("Jane Doe", professors.get(0).getName()); + assertEquals("Professor", professors.get(0).getRole()); + } }