Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ararchch committed Apr 3, 2024
1 parent 3d4d6e4 commit ede9311
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static seedu.address.logic.commands.CommandTestUtil.VALID_DATE;
import static seedu.address.logic.commands.CommandTestUtil.assertCommandFailure;
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.getTypicalAddressBook;
import static seedu.address.testutil.TypicalIndexes.INDEX_FIRST_APPOINTMENT;
import static seedu.address.testutil.TypicalIndexes.INDEX_SECOND_APPOINTMENT;
Expand All @@ -17,6 +19,7 @@
import seedu.address.commons.core.index.Index;
import seedu.address.logic.Messages;
import seedu.address.logic.commands.EditAppointmentCommand.EditAppointmentDescriptor;
import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.model.AddressBook;
import seedu.address.model.Model;
import seedu.address.model.ModelManager;
Expand Down Expand Up @@ -103,6 +106,16 @@ public void execute_filteredList_success() {
assertCommandSuccess(editAppointmentCommand, model, expectedMessage, expectedModel);
}

@Test
public void execute_appointmentAlreadyExists_failure() {
model.addAppointment(APPOINTMENT_1);
Index idx = Index.fromOneBased(1);
EditAppointmentDescriptor descriptor = new EditAppointmentDescriptorBuilder().withDate("2124-03-19").build();
EditAppointmentCommand editAppointmentCommand = new EditAppointmentCommand(idx, descriptor);

assertThrows(CommandException.class, () -> editAppointmentCommand.execute(model));
}

@Test
public void execute_invalidAppointmentIndexUnfilteredList_failure() {
Index outOfBoundIndex = Index.fromOneBased(model.getFilteredAppointmentList().size() + 1);
Expand Down

0 comments on commit ede9311

Please sign in to comment.