Skip to content

Commit

Permalink
Merge pull request AY2324S2-CS2103T-T08-1#54 from jovantanyk/fix-json…
Browse files Browse the repository at this point in the history
…-testcases

fix: Remove optional fields from Test
  • Loading branch information
NatLeong authored Mar 21, 2024
2 parents b274fc5 + bf9c2e0 commit b582a4e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
9 changes: 3 additions & 6 deletions src/main/java/seedu/address/logic/parser/ParserUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static Index parseIndex(String oneBasedIndex) throws ParseException {
public static Nric parseNric(String nric) throws ParseException {
requireNonNull(nric);
String trimmedNric = nric.trim();
if (!Name.isValidName(trimmedNric)) {
if (!Nric.isValidNric(trimmedNric)) {
throw new ParseException(Nric.MESSAGE_CONSTRAINTS);
}
return new Nric(trimmedNric);
Expand Down Expand Up @@ -133,7 +133,7 @@ public static Sex parseSex(String sex) throws ParseException {
requireNonNull(sex);
String trimmedSex = sex.trim();
if (!Sex.isValidSex(trimmedSex)) {
throw new ParseException(Status.MESSAGE_CONSTRAINTS);
throw new ParseException(Sex.MESSAGE_CONSTRAINTS);
}
return new Sex(sex);
}
Expand Down Expand Up @@ -172,7 +172,7 @@ public static DateOfAdmission parseDateOfAdmission(String dateOfAdmission) throw
requireNonNull(dateOfAdmission);
String trimmedDateOfAdmission = dateOfAdmission.trim();
if (!DateOfAdmission.isValidDateOfAdmission(trimmedDateOfAdmission)) {
throw new ParseException(DateOfBirth.MESSAGE_CONSTRAINTS);
throw new ParseException(DateOfAdmission.MESSAGE_CONSTRAINTS);
}
return new DateOfAdmission(trimmedDateOfAdmission);
}
Expand Down Expand Up @@ -202,9 +202,6 @@ public static BloodType parseBloodType(String bloodType) throws ParseException {
public static Allergies parseAllergies(String allergies) throws ParseException {
requireNonNull(allergies);
String trimmedAllergies = allergies.trim();
if (!Address.isValidAddress(trimmedAllergies)) {
throw new ParseException(Address.MESSAGE_CONSTRAINTS);
}
return new Allergies(trimmedAllergies);
}
/**
Expand Down
12 changes: 7 additions & 5 deletions src/test/java/seedu/address/testutil/PersonBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,22 @@ public class PersonBuilder {
public static final String DEFAULT_NRIC = "T1234567B";
public static final String DEFAULT_NAME = "Amy Bee";
public static final String DEFAULT_PHONE = "85355255";
public static final String DEFAULT_EMAIL = "[email protected]";
public static final String DEFAULT_DOB = "1998-07-03";
public static final String DEFAULT_SEX = "M";
// Data fields
public static final String DEFAULT_ADDRESS = "123, Jurong West Ave 6, #08-111";
public static final String DEFAULT_STATUS = "HEALTHY";
/*
public static final String DEFAULT_EMAIL = "[email protected]";
public static final String DEFAULT_ALLERGIES = "Peanuts";
public static final String[] DEFAULT_BLOODTYPE = {"A", "POSITIVE"};
public static final String DEFAULT_COUNTRY = "Singapore";
// Medical history
public static final String DEFAULT_CONDITION = "High blood pressure";
public static final String DEFAULT_DOA = "2024-01-01";
public static final String DEFAULT_DIAGNOSIS = "Runny nose";
public static final String DEFAULT_STATUS = "HEALTHY";
public static final String DEFAULT_SYMPTOM = "Sneezing, sniffing";

*/
// Mandatory fields
private Nric nric;
private Name name;
Expand Down Expand Up @@ -69,8 +70,9 @@ public PersonBuilder() {
address = new Address(DEFAULT_ADDRESS);
dateOfBirth = new DateOfBirth(DEFAULT_DOB);
sex = new Sex(DEFAULT_SEX);
status = new Status(DEFAULT_STATUS);

address = new Address(DEFAULT_ADDRESS);
/*
allergies = new Allergies(DEFAULT_ALLERGIES);
bloodType = new BloodType(DEFAULT_BLOODTYPE[0], DEFAULT_BLOODTYPE[1]);
country = new Country(DEFAULT_COUNTRY);
Expand All @@ -79,8 +81,8 @@ public PersonBuilder() {
condition = new Condition(DEFAULT_CONDITION);
dateOfAdmission = new DateOfAdmission(DEFAULT_DOA);
diagnosis = new Diagnosis(DEFAULT_DIAGNOSIS);
status = new Status(DEFAULT_STATUS);
symptom = new Symptom(DEFAULT_SYMPTOM);
*/
}

/**
Expand Down

0 comments on commit b582a4e

Please sign in to comment.