Skip to content

Commit

Permalink
Add tests for hasAppointment in model manager
Browse files Browse the repository at this point in the history
  • Loading branch information
zaidansani committed Nov 6, 2024
1 parent 69f5121 commit f1bbe9e
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/test/java/seedu/address/model/ModelManagerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import static org.junit.jupiter.api.Assertions.assertTrue;
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS;
import static seedu.address.testutil.Assert.assertThrows;
import static seedu.address.testutil.TypicalAppointments.APPOINTMENT_1;
import static seedu.address.testutil.TypicalAppointments.getTypicalAppointmentBook;
import static seedu.address.testutil.TypicalPersons.ALICE;
import static seedu.address.testutil.TypicalPersons.ALICE_P;
Expand All @@ -18,6 +19,7 @@
import org.junit.jupiter.api.Test;

import seedu.address.commons.core.GuiSettings;
import seedu.address.model.appointment.Appointment;
import seedu.address.model.person.NameContainsKeywordsPredicate;
import seedu.address.model.person.Person;
import seedu.address.testutil.AddressBookBuilder;
Expand Down Expand Up @@ -92,6 +94,26 @@ public void hasPerson_personInAddressBook_returnsTrue() {
assertTrue(modelManager.hasPerson(ALICE));
}

@Test
public void hasAppointment_nullAppointment_throwsNullPointerException() {
assertThrows(NullPointerException.class, () -> modelManager.hasAppointment((Appointment) null));
}

@Test
public void hasAppointment_appointmentNotInAppointmentBook_returnsFalse() {
assertFalse(modelManager.hasAppointment(APPOINTMENT_1));
assertFalse(modelManager.hasAppointment(APPOINTMENT_1.getAppointmentDescriptor(),
APPOINTMENT_1.getPerson()));
}

@Test
public void hasAppointment_appointmentInAppointmentBook_returnsTrue() {
modelManager.addAppointment(APPOINTMENT_1.getPerson(), APPOINTMENT_1.getAppointmentDescriptor());
assertTrue(modelManager.hasAppointment(APPOINTMENT_1));
assertTrue(modelManager.hasAppointment(APPOINTMENT_1.getAppointmentDescriptor(),
APPOINTMENT_1.getPerson()));
}

@Test
public void getFilteredPersonList_modifyList_throwsUnsupportedOperationException() {
assertThrows(UnsupportedOperationException.class, () -> modelManager.getFilteredPersonList().remove(0));
Expand Down

0 comments on commit f1bbe9e

Please sign in to comment.