forked from AY2324S1-CS2103T-T12-4/tp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
510 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,8 @@ | |
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.DateTime; | ||
import seedu.address.model.person.appointment.UniqueAppointmentList; | ||
|
||
|
||
|
@@ -25,7 +27,7 @@ public static Person[] getSamplePersons() { | |
return new Person[] { | ||
new Person(new Name("Alex Yeoh"), new Email("[email protected]"), new Phone("87438807"), | ||
new Gender("M"), new Age(12), new BloodType("A+"), getAllergySet("Peanuts"), | ||
true, new UniqueAppointmentList()), | ||
true, getAppointmentList(new Appointment(new Name("Eye Exam"), new DateTime("01-01-2001 1200")))), | ||
new Person(new Name("Bernice Yu"), new Email("[email protected]"), new Phone("99272758"), | ||
new Gender("F"), new Age(31), new BloodType("B+"), getAllergySet("Dust", "Peanuts"), | ||
false, new UniqueAppointmentList()), | ||
|
@@ -53,12 +55,22 @@ public static ReadOnlyAddressBook getSampleAddressBook() { | |
} | ||
|
||
/** | ||
* Returns a tag set containing the list of strings given. | ||
* Returns an allergy set containing the list of strings given. | ||
*/ | ||
public static Set<Allergy> getAllergySet(String... strings) { | ||
return Arrays.stream(strings) | ||
.map(Allergy::new) | ||
.collect(Collectors.toSet()); | ||
} | ||
|
||
/** | ||
* Returns an appointment list containing the list of appointments given. | ||
*/ | ||
public static UniqueAppointmentList getAppointmentList(Appointment... appointments) { | ||
UniqueAppointmentList appointmentList = new UniqueAppointmentList(); | ||
for (Appointment appointment : appointments) { | ||
appointmentList.add(appointment); | ||
} | ||
return appointmentList; | ||
} | ||
} |
45 changes: 34 additions & 11 deletions
45
src/test/data/JsonAddressBookStorageTest/invalidAndValidPersonAddressBook.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,36 @@ | ||
{ | ||
"persons": [ { | ||
"name": "Valid Person", | ||
"phone": "9482424", | ||
"email": "[email protected]", | ||
"address": "4th street" | ||
}, { | ||
"name": "Person With Invalid Phone Field", | ||
"phone": "948asdf2424", | ||
"email": "[email protected]", | ||
"address": "4th street" | ||
} ] | ||
"persons": [ | ||
{ | ||
"name": "Valid Person", | ||
"phone": "9482424", | ||
"email": "[email protected]", | ||
"gender": "M", | ||
"age": "18", | ||
"bloodType": "A+", | ||
"allergies": ["Peanuts"], | ||
"isPinned": true, | ||
"appointments": [ | ||
{ | ||
"title": "Eye Examination", | ||
"dateTime": "18-09-2023 1800" | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "Person With Invalid Phone Field", | ||
"phone": "948asdf2424", | ||
"email": "[email protected]", | ||
"gender": "M", | ||
"age": "18", | ||
"bloodType": "A+", | ||
"allergies": ["Peanuts"], | ||
"isPinned": true, | ||
"appointments": [ | ||
{ | ||
"title": "Eye Examination", | ||
"dateTime": "18-09-2023 1800" | ||
} | ||
] | ||
} | ||
] | ||
} |
24 changes: 18 additions & 6 deletions
24
src/test/data/JsonAddressBookStorageTest/invalidPersonAddressBook.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,20 @@ | ||
{ | ||
"persons": [ { | ||
"name": "Person with invalid name field: Ha!ns Mu@ster", | ||
"phone": "9482424", | ||
"email": "[email protected]", | ||
"address": "4th street" | ||
} ] | ||
"persons": [ | ||
{ | ||
"name": "Person with invalid name field: Ha!ns Mu@ster", | ||
"phone": "9482424", | ||
"email": "[email protected]", | ||
"gender": "M", | ||
"age": "18", | ||
"bloodType": "A+", | ||
"allergies": ["Peanuts"], | ||
"isPinned": true, | ||
"appointments": [ | ||
{ | ||
"title": "Eye Examination", | ||
"dateTime": "18-09-2023 1800" | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 18 additions & 6 deletions
24
src/test/data/JsonSerializableAddressBookTest/invalidPersonAddressBook.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,20 @@ | ||
{ | ||
"persons": [ { | ||
"name": "Hans Muster", | ||
"phone": "9482424", | ||
"email": "invalid@email!3e", | ||
"address": "4th street" | ||
} ] | ||
"persons": [ | ||
{ | ||
"name": "Hans Muster", | ||
"phone": "9482424", | ||
"email": "invalid@email!3e", | ||
"gender": "M", | ||
"age": "18", | ||
"bloodType": "A+", | ||
"allergies": ["Peanuts"], | ||
"isPinned": true, | ||
"appointments": [ | ||
{ | ||
"title": "Eye Examination", | ||
"dateTime": "18-09-2023 1800" | ||
} | ||
] | ||
} | ||
] | ||
} |
Oops, something went wrong.