Skip to content

Commit

Permalink
Add test for list commands
Browse files Browse the repository at this point in the history
  • Loading branch information
S-Aishvarya committed Apr 15, 2024
1 parent d6be804 commit 34ee9a4
Showing 1 changed file with 60 additions and 0 deletions.
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));
}
}

0 comments on commit 34ee9a4

Please sign in to comment.