diff --git a/src/main/java/seedu/address/model/person/Nric.java b/src/main/java/seedu/address/model/person/Nric.java index 8955f6ae73f..79a3460b5e8 100644 --- a/src/main/java/seedu/address/model/person/Nric.java +++ b/src/main/java/seedu/address/model/person/Nric.java @@ -18,7 +18,7 @@ public class Nric { * The first character of the address must not be a whitespace, * otherwise " " (a blank string) becomes a valid input. */ - public static final String VALIDATION_REGEX = "^[ST]\\\\d{7}[A-Z]$"; + public static final String VALIDATION_REGEX = "^[ST]\\d{7}[A-Z]$"; private final String nric; diff --git a/src/main/java/seedu/address/storage/JsonAdaptedPerson.java b/src/main/java/seedu/address/storage/JsonAdaptedPerson.java index ef9390436a2..524854bfd2a 100644 --- a/src/main/java/seedu/address/storage/JsonAdaptedPerson.java +++ b/src/main/java/seedu/address/storage/JsonAdaptedPerson.java @@ -55,8 +55,7 @@ public JsonAdaptedPerson(@JsonProperty("nric") String nric, @JsonProperty("name" @JsonProperty("status") String status, @JsonProperty("email") String email, @JsonProperty("country") String country, @JsonProperty("allergies") String allergies, @JsonProperty("bloodType") String bloodType, @JsonProperty("condition") String condition, - @JsonProperty("dateOfAdmission") String doa, - @JsonProperty("diagnosis") String diagnosis, + @JsonProperty("dateOfAdmission") String doa, @JsonProperty("diagnosis") String diagnosis, @JsonProperty("symptom") String symptom) { this.nric = nric; this.name = name; @@ -84,7 +83,7 @@ public JsonAdaptedPerson(Person source) { this.phone = source.getPhone().toString(); this.address = source.getAddress().toString(); this.dateOfBirth = source.getDateOfBirth().toString(); - this.sex = source.getEmail().toString(); + this.sex = source.getSex().toString(); this.status = source.getStatus().toString(); this.email = Optional.ofNullable(source.getEmail().toString()); this.country = Optional.ofNullable(source.getCountry().toString()); @@ -139,11 +138,11 @@ public Person toModelType() throws IllegalValueException { final Address modelAddress = new Address(address); // Date of Birth Check if (dateOfBirth == null) { - throw new IllegalValueException( - String.format(MISSING_FIELD_MESSAGE_FORMAT, DateOfBirth.class.getSimpleName())); + throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, + DateOfBirth.class.getSimpleName())); } if (!DateOfBirth.isValidDateOfBirth(dateOfBirth)) { - throw new IllegalValueException(Phone.MESSAGE_CONSTRAINTS); + throw new IllegalValueException(DateOfBirth.MESSAGE_CONSTRAINTS); } final DateOfBirth modelDateOfBirth = new DateOfBirth(dateOfBirth); // Sex Check diff --git a/src/test/java/seedu/address/storage/JsonAdaptedPersonTest.java b/src/test/java/seedu/address/storage/JsonAdaptedPersonTest.java index 2525c9d88a1..3803c387f61 100644 --- a/src/test/java/seedu/address/storage/JsonAdaptedPersonTest.java +++ b/src/test/java/seedu/address/storage/JsonAdaptedPersonTest.java @@ -65,7 +65,7 @@ public void toModelType_nullNric_throwsIllegalValueException() { VALID_ADDRESS, VALID_DOB, VALID_SEX, VALID_STATUS, VALID_EMAIL, VALID_COUNTRY, VALID_ALLERGIES, VALID_BLOODTYPE, VALID_CONDITION, VALID_DOA, VALID_DIAGNOSIS, VALID_SYMPTOM); - String expectedMessage = String.format(MISSING_FIELD_MESSAGE_FORMAT, Name.class.getSimpleName()); + String expectedMessage = String.format(MISSING_FIELD_MESSAGE_FORMAT, Nric.class.getSimpleName()); assertThrows(IllegalValueException.class, expectedMessage, person::toModelType); } @Test diff --git a/src/test/java/seedu/address/testutil/TypicalPersons.java b/src/test/java/seedu/address/testutil/TypicalPersons.java index 0fe7b5b0273..00bdcd69b95 100644 --- a/src/test/java/seedu/address/testutil/TypicalPersons.java +++ b/src/test/java/seedu/address/testutil/TypicalPersons.java @@ -37,21 +37,21 @@ public class TypicalPersons { .withName("Daniel Meier").withPhone("87652533") .withAddress("10th street").withSex("M").withStatus("HEALTHY").build(); public static final Person ELLE = new PersonBuilder().withNric("S8913957B") - .withName("Elle Meyer").withPhone("9482224") + .withName("Elle Meyer").withPhone("94821224") .withAddress("michegan ave").withSex("F").withStatus("UNWELL").build(); public static final Person FIONA = new PersonBuilder().withNric("T0536171Z") - .withName("Fiona Kunz").withPhone("9482427") + .withName("Fiona Kunz").withPhone("94820427") .withAddress("little tokyo").withSex("F").withStatus("PENDING").build(); public static final Person GEORGE = new PersonBuilder().withNric("T0829102Z") - .withName("George Best").withPhone("9482442") + .withName("George Best").withPhone("94824421") .withAddress("4th street").withSex("M").withStatus("HEALTHY").build(); // Manually added public static final Person HOON = new PersonBuilder().withNric("T0123071C").withName("Hoon Meier") - .withPhone("8482424").withAddress("little india") + .withPhone("81482424").withAddress("little india") .withSex("M").withStatus("HEALTHY").build(); public static final Person IDA = new PersonBuilder().withNric("T0239521A").withName("Ida Mueller") - .withPhone("8482131").withAddress("chicago ave") + .withPhone("84820131").withAddress("chicago ave") .withSex("F").withStatus("PENDING").build(); // Manually added - Person's details found in {@code CommandTestUtil}