|
|
@ -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<Professor> 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()); |
|
|
|
} |
|
|
|
} |