Skip to content

Commit

Permalink
Modify withAppointments method
Browse files Browse the repository at this point in the history
  • Loading branch information
Darren159 committed Oct 19, 2023
1 parent 0c90ffc commit 7d790a8
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"isPinned": true,
"appointments": [
{
"name": "Eye Examination",
"dateTime": "18-09-2023 1800"
"name": "Eye Exam",
"dateTime": "01-01-2001 1200"
}
]
},
Expand All @@ -28,8 +28,8 @@
"isPinned": true,
"appointments": [
{
"name": "Eye Examination",
"dateTime": "18-09-2023 1800"
"name": "Eye Exam",
"dateTime": "01-01-2001 1200"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@
{
"name": "Eye Exam",
"dateTime": "01-01-2001 1200"
},
{
"name": "Vaccination",
"dateTime": "11-09-2001 1200"
},
{
"name": "Colonoscopy",
"dateTime": "21-12-2001 1200"
}
]
},
Expand All @@ -35,17 +27,9 @@
"allergies": ["Pollen", "Soil"],
"isPinned": false,
"appointments": [
{
"name": "Eye Exam",
"dateTime": "01-01-2001 1200"
},
{
"name": "Vaccination",
"dateTime": "11-09-2001 1200"
},
{
"name": "Colonoscopy",
"dateTime": "21-12-2001 1200"
}
]
},
Expand All @@ -59,14 +43,6 @@
"allergies": ["Dogs"],
"isPinned": false,
"appointments": [
{
"name": "Eye Exam",
"dateTime": "01-01-2001 1200"
},
{
"name": "Vaccination",
"dateTime": "11-09-2001 1200"
},
{
"name": "Colonoscopy",
"dateTime": "21-12-2001 1200"
Expand Down
9 changes: 9 additions & 0 deletions src/test/java/seedu/address/testutil/PersonBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import seedu.address.model.person.Name;
import seedu.address.model.person.Person;
import seedu.address.model.person.Phone;
import seedu.address.model.person.appointment.Appointment;
import seedu.address.model.person.appointment.UniqueAppointmentList;
import seedu.address.model.util.SampleDataUtil;

Expand Down Expand Up @@ -139,6 +140,14 @@ public PersonBuilder withAppointments(UniqueAppointmentList appointment) {
return this;
}

/**
* Sets the {@code appointments} of the {@code Person} that we are building.
*/
public PersonBuilder withAppointments(Appointment ... appointments) {
this.appointments = SampleDataUtil.getAppointmentList(appointments);
return this;
}

public Person build() {
return new Person(name, email, phone, gender, age, bloodType, allergies, isPinned, appointments);
}
Expand Down
9 changes: 6 additions & 3 deletions src/test/java/seedu/address/testutil/TypicalPersons.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
import static seedu.address.logic.commands.CommandTestUtil.VALID_NAME_BOB;
import static seedu.address.logic.commands.CommandTestUtil.VALID_PHONE_AMY;
import static seedu.address.logic.commands.CommandTestUtil.VALID_PHONE_BOB;
import static seedu.address.testutil.TypicalAppointments.COLONOSCOPY;
import static seedu.address.testutil.TypicalAppointments.EYE_EXAM;
import static seedu.address.testutil.TypicalAppointments.VACCINATION;

import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -34,7 +37,7 @@ public class TypicalPersons {
.withBloodType("AB+")
.withAllergies("Chocolate")
.withIsPinned(true)
.withAppointments(TypicalAppointments.getTypicalAppointments()).build();
.withAppointments(EYE_EXAM).build();
public static final Person BENSON = new PersonBuilder().withName("Benson Meier")
.withEmail("[email protected]")
.withPhone("98765432")
Expand All @@ -43,7 +46,7 @@ public class TypicalPersons {
.withBloodType("B-")
.withAllergies("Pollen", "Soil")
.withIsPinned(false)
.withAppointments(TypicalAppointments.getTypicalAppointments()).build();
.withAppointments(VACCINATION).build();
public static final Person CARL = new PersonBuilder().withName("Carl Kurz")
.withEmail("[email protected]")
.withPhone("95352563")
Expand All @@ -52,7 +55,7 @@ public class TypicalPersons {
.withBloodType("AB-")
.withAllergies("Dogs")
.withIsPinned(false)
.withAppointments(TypicalAppointments.getTypicalAppointments()).build();
.withAppointments(COLONOSCOPY).build();
public static final Person DANIEL = new PersonBuilder().withName("Daniel Meier")
.withEmail("[email protected]")
.withPhone("87652533")
Expand Down

0 comments on commit 7d790a8

Please sign in to comment.