Skip to content

Commit

Permalink
Add appointment to PersonBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
reidenong committed Oct 17, 2024
1 parent 112a00f commit a1c50ae
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 27 deletions.
13 changes: 13 additions & 0 deletions src/test/java/seedu/address/testutil/PersonBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.Set;

import seedu.address.model.person.Address;
import seedu.address.model.person.Appointment;
import seedu.address.model.person.Email;
import seedu.address.model.person.Name;
import seedu.address.model.person.Nric;
Expand All @@ -24,6 +25,7 @@ public class PersonBuilder {
public static final String DEFAULT_NRIC = "S1234567A";
public static final String DEFAULT_ADDRESS = "123, Jurong West Ave 6, #08-111";
public static final String DEFAULT_REMARK = "She likes Marvel movies";
public static final String DEFAULT_APPOINTMENT = "19-10-2021 12:34";

private Name name;
private Phone phone;
Expand All @@ -32,6 +34,7 @@ public class PersonBuilder {
private Address address;
private Remark remark;
private Set<Tag> tags;
private Appointment appointment;

/**
* Creates a {@code PersonBuilder} with the default details.
Expand All @@ -43,6 +46,7 @@ public PersonBuilder() {
nric = new Nric(DEFAULT_NRIC);
address = new Address(DEFAULT_ADDRESS);
remark = new Remark(DEFAULT_REMARK);
appointment = new Appointment(DEFAULT_APPOINTMENT);
tags = new HashSet<>();
}

Expand All @@ -57,6 +61,7 @@ public PersonBuilder(Person personToCopy) {
address = personToCopy.getAddress();
remark = personToCopy.getRemark();
tags = new HashSet<>(personToCopy.getTags());
appointment = personToCopy.getAppointment();
}

/**
Expand Down Expand Up @@ -115,6 +120,14 @@ public PersonBuilder withNric(String nric) {
return this;
}

/**
* Sets the {@code Appointment} of the {@code Person} that we are building.
*/
public PersonBuilder withAppointment(String appointment) {
this.appointment = new Appointment(appointment);
return this;
}

public Person build() {
return new Person(name, phone, email, nric, address, remark, tags, null);
}
Expand Down
111 changes: 84 additions & 27 deletions src/test/java/seedu/address/testutil/TypicalPersons.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,47 +25,104 @@
*/
public class TypicalPersons {

public static final Person ALICE = new PersonBuilder().withName("Alice Pauline")
.withAddress("123, Jurong West Ave 6, #08-111").withEmail("[email protected]")
.withPhone("94351253").withNric("S1234567A")
public static final Person ALICE = new PersonBuilder()
.withName("Alice Pauline")
.withAddress("123, Jurong West Ave 6, #08-111")
.withEmail("[email protected]")
.withPhone("94351253")
.withNric("S1234567A")
.withRemark("she likes puppies")
.withTags("friends").build();
public static final Person BENSON = new PersonBuilder().withName("Benson Meier")
.withTags("friends")
.withAppointment("02-11-2024 09:19")
.build();
public static final Person BENSON = new PersonBuilder()
.withName("Benson Meier")
.withAddress("311, Clementi Ave 2, #02-25")
.withEmail("[email protected]").withPhone("98765432").withNric("S1234567B")
.withEmail("[email protected]")
.withPhone("98765432")
.withNric("S1234567B")
.withRemark("He can't handle his alcohol")
.withTags("owesMoney", "friends").build();
public static final Person CARL = new PersonBuilder().withName("Carl Kurz").withPhone("95352563")
.withTags("owesMoney", "friends")
.withAppointment("29-10-2024 20:24")
.build();
public static final Person CARL = new PersonBuilder()
.withName("Carl Kurz")
.withPhone("95352563")
.withNric("S1234567C")
.withEmail("[email protected]").withAddress("wall street").build();
public static final Person DANIEL = new PersonBuilder().withName("Daniel Meier").withPhone("87652533")
.withEmail("[email protected]")
.withAddress("wall street")
.withAppointment("01-11-2024 20:45")
.build();
public static final Person DANIEL = new PersonBuilder()
.withName("Daniel Meier")
.withPhone("87652533")
.withNric("S1234567D")
.withEmail("[email protected]").withAddress("10th street").withTags("friends").build();
public static final Person ELLE = new PersonBuilder().withName("Elle Meyer").withPhone("9482224")
.withEmail("[email protected]")
.withAddress("10th street")
.withTags("friends")
.withAppointment("08-11-2024 10:10")
.build();
public static final Person ELLE = new PersonBuilder()
.withName("Elle Meyer")
.withPhone("9482224")
.withNric("S1234567E")
.withEmail("[email protected]").withAddress("michegan ave").build();
public static final Person FIONA = new PersonBuilder().withName("Fiona Kunz").withPhone("9482427")
.withEmail("[email protected]")
.withAddress("michegan ave")
.withAppointment("10-11-2024 05:31")
.build();
public static final Person FIONA = new PersonBuilder()
.withName("Fiona Kunz")
.withPhone("9482427")
.withNric("S1234567F")
.withEmail("[email protected]").withAddress("little tokyo").build();
public static final Person GEORGE = new PersonBuilder().withName("George Best").withPhone("9482442")
.withEmail("[email protected]")
.withAddress("little tokyo")
.withAppointment("08-11-2024 13:22")
.build();
public static final Person GEORGE = new PersonBuilder()
.withName("George Best")
.withPhone("9482442")
.withNric("S1234567G")
.withEmail("[email protected]").withAddress("4th street").build();
.withEmail("[email protected]")
.withAddress("4th street")
.withAppointment("07-11-2024 22:33")
.build();

// Manually added
public static final Person HOON = new PersonBuilder().withName("Hoon Meier").withPhone("8482424")
public static final Person HOON = new PersonBuilder()
.withName("Hoon Meier")
.withPhone("8482424")
.withNric("S1234567H")
.withEmail("[email protected]").withAddress("little india").build();
public static final Person IDA = new PersonBuilder().withName("Ida Mueller").withPhone("8482131")
.withEmail("[email protected]")
.withAddress("little india")
.withAppointment("12-11-2024 06:22")
.build();
public static final Person IDA = new PersonBuilder()
.withName("Ida Mueller")
.withPhone("8482131")
.withNric("S1234567I")
.withEmail("[email protected]").withAddress("chicago ave").build();
.withEmail("[email protected]")
.withAddress("chicago ave")
.withAppointment("22-10-2024 01:14")
.build();

// Manually added - Person's details found in {@code CommandTestUtil}
public static final Person AMY = new PersonBuilder().withName(VALID_NAME_AMY).withPhone(VALID_PHONE_AMY)
.withEmail(VALID_EMAIL_AMY).withNric(VALID_NRIC_AMY).withAddress(VALID_ADDRESS_AMY)
.withTags(VALID_TAG_FRIEND).build();
public static final Person BOB = new PersonBuilder().withName(VALID_NAME_BOB).withPhone(VALID_PHONE_BOB)
.withEmail(VALID_EMAIL_BOB).withNric(VALID_NRIC_BOB)
.withAddress(VALID_ADDRESS_BOB).withTags(VALID_TAG_HUSBAND, VALID_TAG_FRIEND)
public static final Person AMY = new PersonBuilder()
.withName(VALID_NAME_AMY)
.withPhone(VALID_PHONE_AMY)
.withEmail(VALID_EMAIL_AMY)
.withNric(VALID_NRIC_AMY)
.withAddress(VALID_ADDRESS_AMY)
.withTags(VALID_TAG_FRIEND)
.withAppointment("23-10-2024 22:50")
.build();
public static final Person BOB = new PersonBuilder()
.withName(VALID_NAME_BOB)
.withPhone(VALID_PHONE_BOB)
.withEmail(VALID_EMAIL_BOB)
.withNric(VALID_NRIC_BOB)
.withAddress(VALID_ADDRESS_BOB)
.withTags(VALID_TAG_HUSBAND, VALID_TAG_FRIEND)
.withAppointment("16-11-2024 20:44")
.build();

public static final String KEYWORD_MATCHING_MEIER = "Meier"; // A keyword that matches MEIER
Expand Down

0 comments on commit a1c50ae

Please sign in to comment.