From 6662ca9e9fcc26f0626f59864c6fd30e168c8462 Mon Sep 17 00:00:00 2001 From: alfaloo Date: Mon, 15 Apr 2024 16:51:24 +0800 Subject: [PATCH] Minor issues --- docs/UserGuide.md | 2 +- .../address/logic/commands/EditAppointmentCommand.java | 3 +++ .../java/seedu/address/logic/commands/EditCommand.java | 3 +++ src/test/java/seedu/address/logic/LogicManagerTest.java | 9 +++++---- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/docs/UserGuide.md b/docs/UserGuide.md index 941bc3a1409..5d854cb07da 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -170,7 +170,7 @@ MediCLI is operated using typed commands to the command line interface (CLI). Do ### Quick Tutorial on a Sample Use Case -1. Type the command in the command box and press Enter to execute it. e.g. typing **`help`** and pressing Enter will open the help window.
' +1. Type the command in the command box and press Enter to execute it. e.g. typing **`help`** and pressing Enter will open the help window.
:exclamation: **DANGER**: If you are using a PDF version of this document, be careful when copying and pasting commands that span multiple lines as space characters surrounding line breaks may be omitted when copied over to the application.
diff --git a/src/main/java/seedu/address/logic/commands/EditAppointmentCommand.java b/src/main/java/seedu/address/logic/commands/EditAppointmentCommand.java index 4972a4d664b..19ec65e7dae 100644 --- a/src/main/java/seedu/address/logic/commands/EditAppointmentCommand.java +++ b/src/main/java/seedu/address/logic/commands/EditAppointmentCommand.java @@ -148,6 +148,9 @@ public EditAppointmentDescriptor() {} * A defensive copy of {@code tags} is used internally. */ public EditAppointmentDescriptor(EditAppointmentDescriptor toCopy) { + if (toCopy == null) { // Defensive Coding + throw new IllegalArgumentException(); + } setDateTime(toCopy.apptdatetime); setDoctorNric(toCopy.doctorNric); setPatientNric(toCopy.patientNric); diff --git a/src/main/java/seedu/address/logic/commands/EditCommand.java b/src/main/java/seedu/address/logic/commands/EditCommand.java index 20fddcc592b..1baba51a002 100644 --- a/src/main/java/seedu/address/logic/commands/EditCommand.java +++ b/src/main/java/seedu/address/logic/commands/EditCommand.java @@ -184,6 +184,9 @@ public EditPersonDescriptor() { * A defensive copy of {@code tags} is used internally. */ public EditPersonDescriptor(EditPersonDescriptor toCopy) { + if (toCopy == null) { // Defensive Coding + throw new IllegalArgumentException(); + } setName(toCopy.name); setPhone(toCopy.phone); setNric(toCopy.nric); diff --git a/src/test/java/seedu/address/logic/LogicManagerTest.java b/src/test/java/seedu/address/logic/LogicManagerTest.java index 29b958be01a..bae99b8cea8 100644 --- a/src/test/java/seedu/address/logic/LogicManagerTest.java +++ b/src/test/java/seedu/address/logic/LogicManagerTest.java @@ -30,12 +30,13 @@ import seedu.address.model.ModelManager; import seedu.address.model.ReadOnlyAddressBook; import seedu.address.model.UserPrefs; -import seedu.address.model.appointment.Appointment; -import seedu.address.model.appointment.AppointmentDateTime; +import seedu.address.model.person.Doctor; +import seedu.address.model.person.Patient; import seedu.address.model.person.Person; import seedu.address.storage.JsonAddressBookStorage; import seedu.address.storage.JsonUserPrefsStorage; import seedu.address.storage.StorageManager; +import seedu.address.testutil.AppointmentBuilder; import seedu.address.testutil.PatientBuilder; public class LogicManagerTest { private static final IOException DUMMY_IO_EXCEPTION = new IOException("dummy IO exception"); @@ -100,8 +101,8 @@ public void getFilteredAppointmentList_modifyList_throwsUnsupportedOperationExce public void getAppointmentList_getList_listIsNotNull() throws ParseException { model.addPerson(ALICE); model.addPerson(BROWN); - model.addAppointment( - new Appointment(BROWN.getNric(), ALICE.getNric(), new AppointmentDateTime("2024-11-11 11:02"), false)); + model.addAppointment(new AppointmentBuilder().withDoctor((Doctor) BROWN) + .withPatient((Patient) ALICE).withDateTime("2024-11-11 11:02").build()); assertTrue(model.getFilteredAppointmentList() != null); assertTrue(model.getFilteredAppointmentList().size() == 1); }