forked from nus-cs2103-AY2324S2/tp
-
Notifications
You must be signed in to change notification settings - Fork 4
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
d6be804
commit 34ee9a4
Showing
1 changed file
with
60 additions
and
0 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
src/test/java/seedu/address/model/patient/ApptDateMatchesPredicateTest.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,60 @@ | ||
package seedu.address.model.patient; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import java.time.LocalDate; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import seedu.address.logic.parser.ParserUtil; | ||
import seedu.address.logic.parser.exceptions.ParseException; | ||
|
||
|
||
class ApptDateMatchesPredicateTest { | ||
|
||
|
||
@Test | ||
void testEquals() { | ||
String firstApptDate = "01/02/2024"; | ||
LocalDate firstAppt = null; | ||
String firstApptDate2 = "01/02/2024"; | ||
LocalDate firstAppt2 = null; | ||
|
||
String secondApptDate = "2024-2-1"; | ||
LocalDate secondAppt = null; | ||
try { | ||
firstAppt = ParserUtil.parseAppointment(firstApptDate).appointment; | ||
firstAppt2 = ParserUtil.parseAppointment(firstApptDate2).appointment; | ||
secondAppt = ParserUtil.parseAppointment(secondApptDate).appointment; | ||
} catch (ParseException e) { | ||
throw new RuntimeException(e); | ||
} | ||
|
||
ApptDateMatchesPredicate firstPredicate = new ApptDateMatchesPredicate(firstAppt); | ||
ApptDateMatchesPredicate firstPredicate2 = new ApptDateMatchesPredicate(firstAppt2); | ||
ApptDateMatchesPredicate secondPredicate = new ApptDateMatchesPredicate(secondAppt); | ||
assertTrue(firstPredicate.equals(firstPredicate2)); | ||
assertTrue(firstPredicate.equals(secondPredicate)); | ||
assertTrue(firstPredicate2.equals(secondPredicate)); | ||
} | ||
|
||
@Test | ||
void testNotEquals() { | ||
String firstApptDate = "01/02/2024"; | ||
LocalDate firstAppt = null; | ||
|
||
String secondApptDate = "01/01/2024"; | ||
LocalDate secondAppt = null; | ||
try { | ||
firstAppt = ParserUtil.parseAppointment(firstApptDate).appointment; | ||
secondAppt = ParserUtil.parseAppointment(secondApptDate).appointment; | ||
} catch (ParseException e) { | ||
throw new RuntimeException(e); | ||
} | ||
|
||
ApptDateMatchesPredicate firstPredicate = new ApptDateMatchesPredicate(firstAppt); | ||
ApptDateMatchesPredicate secondPredicate = new ApptDateMatchesPredicate(secondAppt); | ||
assertFalse(firstPredicate.equals(secondPredicate)); | ||
} | ||
} |