forked from AY2324S2-CS2103-F15-2/tp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5632538
commit d1f63e4
Showing
11 changed files
with
289 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
src/test/java/seedu/address/model/person/AttendanceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package seedu.address.model.person; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
import static seedu.address.testutil.Assert.assertThrows; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
public class AttendanceTest { | ||
|
||
@Test | ||
public void constructor_null_throwsNullPointerException() { | ||
assertThrows(NullPointerException.class, () -> new Attendance(null)); | ||
} | ||
|
||
@Test | ||
public void constructor_invalidAttendance_throwsIllegalArgumentException() { | ||
String invalidAttendance = "On leave"; | ||
assertThrows(IllegalArgumentException.class, () -> new Attendance(invalidAttendance)); | ||
} | ||
|
||
@Test | ||
public void isValidAttendance() { | ||
// null attendance | ||
assertThrows(NullPointerException.class, () -> Attendance.isValidAttendance(null)); | ||
|
||
// invalid attendance | ||
assertFalse(Attendance.isValidAttendance("On leave")); // Invalid status | ||
|
||
// valid attendance | ||
assertTrue(Attendance.isValidAttendance("Present")); | ||
assertTrue(Attendance.isValidAttendance("Absent")); | ||
} | ||
|
||
@Test | ||
public void equals() { | ||
Attendance attendance = new Attendance("Present"); | ||
|
||
// same values -> returns true | ||
assertTrue(attendance.equals(new Attendance("Present"))); | ||
|
||
// same object -> returns true | ||
assertTrue(attendance.equals(attendance)); | ||
|
||
// null -> returns false | ||
assertFalse(attendance.equals(null)); | ||
|
||
// different types -> returns false | ||
assertFalse(attendance.equals(5.0f)); | ||
|
||
// different values -> returns false | ||
assertFalse(attendance.equals(new Attendance("Absent"))); | ||
} | ||
} |
Oops, something went wrong.