diff --git a/src/test/java/seedu/address/logic/commands/EditAppointmentCommandTest.java b/src/test/java/seedu/address/logic/commands/EditAppointmentCommandTest.java index f8694e6f56f..2eb3bf160a4 100644 --- a/src/test/java/seedu/address/logic/commands/EditAppointmentCommandTest.java +++ b/src/test/java/seedu/address/logic/commands/EditAppointmentCommandTest.java @@ -9,6 +9,7 @@ import static seedu.address.logic.commands.CommandTestUtil.assertCommandSuccess; import static seedu.address.logic.commands.CommandTestUtil.showAppointmentAtIndex; import static seedu.address.testutil.TypicalAppointments.APPOINTMENT_1; +import static seedu.address.testutil.TypicalAppointments.APPOINTMENT_2; import static seedu.address.testutil.TypicalAppointments.getTypicalAddressBook; import static seedu.address.testutil.TypicalIndexes.INDEX_FIRST_APPOINTMENT; import static seedu.address.testutil.TypicalIndexes.INDEX_SECOND_APPOINTMENT; @@ -183,4 +184,12 @@ public void toStringMethod() { assertEquals(expected, editAppointmentCommand.toString()); } + @Test + public void getPatientNric_returnsNricAsOptional() { + model.addAppointment(APPOINTMENT_2); + Index idx = Index.fromOneBased(1); + EditAppointmentDescriptor descriptor = new EditAppointmentDescriptorBuilder().withDate("2124-03-19").build(); + EditAppointmentCommand editAppointmentCommand = new EditAppointmentCommand(idx, descriptor); + } + } diff --git a/src/test/java/seedu/address/model/AddressBookTest.java b/src/test/java/seedu/address/model/AddressBookTest.java index 77ec5a16bb9..5359e4d937b 100644 --- a/src/test/java/seedu/address/model/AddressBookTest.java +++ b/src/test/java/seedu/address/model/AddressBookTest.java @@ -5,9 +5,11 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static seedu.address.logic.commands.CommandTestUtil.VALID_PHONE_BOB; import static seedu.address.testutil.Assert.assertThrows; +import static seedu.address.testutil.TypicalAppointments.APPOINTMENT_1; import static seedu.address.testutil.TypicalPersons.ALICE; import static seedu.address.testutil.TypicalPersons.getTypicalAddressBook; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; @@ -18,6 +20,7 @@ import javafx.collections.FXCollections; import javafx.collections.ObservableList; import seedu.address.model.appointment.Appointment; +import seedu.address.model.appointment.exceptions.DuplicateAppointmentException; import seedu.address.model.person.Nric; import seedu.address.model.person.Person; import seedu.address.model.person.exceptions.DuplicatePersonException; @@ -135,4 +138,26 @@ public void getPersonByNric_addressbookIsEmpty_throwsPersonNotFoundException() { assertThrows(PersonNotFoundException.class, () -> addressBook.getPersonByNric(ALICE.getNric())); } + @Test + public void hasPersonNric_validNric_returnsTrue() { + addressBook.addPerson(ALICE); + assertTrue(addressBook.hasPersonNric(ALICE.getNric().toString())); + } + + @Test + public void setAppointments_validSet_setsAppointments() throws DuplicateAppointmentException { + List appts = new ArrayList<>(); + appts.add(APPOINTMENT_1); + addressBook.setAppointments(appts); + assertTrue(addressBook.hasAppointment(APPOINTMENT_1)); + } + + @Test + public void equalsMethod() { + // same object + assertTrue(addressBook.equals(addressBook)); + // different class + assertFalse(addressBook.equals(APPOINTMENT_1)); + } + }