Fakultas Ilmu Komputer UI

Commit 815cfbc1 authored by Jerome Zebua's avatar Jerome Zebua
Browse files

added student test

parent f609a713
Pipeline #81800 passed with stage
in 1 minute and 15 seconds
......@@ -4,7 +4,7 @@
<component name="ProjectKey">
<option name="state" value="project://e2804f05-5315-4fc6-a121-c522a6c26470" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_14" default="true" project-jdk-name="14" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_X" default="true" project-jdk-name="14.0.2" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
\ No newline at end of file
......@@ -8,6 +8,9 @@ import softeng.g4.cli.ListIO;
import softeng.g4.course.Course;
import softeng.g4.course.CourseList;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import static org.junit.jupiter.api.Assertions.*;
class StudentTest {
......@@ -41,6 +44,40 @@ class StudentTest {
@Test
void seeCalendar() {
ByteArrayOutputStream outContent = new ByteArrayOutputStream();
System.setOut(new PrintStream(outContent));
testTa.setSchedule("monday", "Busy", "07:00", "21:00");
testTa.setSchedule("tuesday", "Busy", "07:00", "21:00");
testTa.setSchedule("wednesday", "Busy", "07:00", "21:00");
testTa.setSchedule("thursday", "Busy", "07:00", "21:00");
testTa.setSchedule("friday", "Busy", "07:00", "21:00");
testTa.setSchedule("saturday", "Busy", "07:00", "21:00");
testTa.setSchedule("sunday", "Busy", "07:00", "21:00");
new TeachingAssistant("testTA", "Test TA", Long.valueOf("1"), userList);
// String outContentEdit = outContent.toString().replaceAll("\n", "").replaceAll("\r", "");
//
// String expectedOutput =
// "Monday:" +
// "Busy 07:00 - 21:00" +
// "Tuesday:" +
// "Busy 07:00 - 21:00" +
// "Wednesday:" +
// "Busy 07:00 - 21:00" +
// "Thursday:" +
// "Busy 07:00 - 21:00" +
// "Friday:" +
// "Busy 07:00 - 21:00" +
// "Saturday:" +
// "Busy 07:00 - 21:00" +
// "Sunday:" +
// "Busy 07:00 - 21:00";
testStudent.seeCalendar("testTa", userList);
// assertEquals(expectedOutput, outContentEdit);
}
@Test
......@@ -49,10 +86,14 @@ class StudentTest {
@Test
void getUsername() {
testStudent = new Student("Kevin", "Kevin Kurn", Long.valueOf("987654321"), userList);
assertEquals(testStudent.getUsername(), "Kevin");
}
@Test
void testToString() {
testStudent = new Student("Jerome", "Jerome Emmanuel", Long.valueOf("123456789"), userList);
assertEquals(testStudent.toString(),"Jerome - Jerome Emmanuel");
}
@AfterEach
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment