-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update JsonAdaptedRecordTest #266
Conversation
* Update test cases for JsonAdaptedRecordTest and modify JsonAdaptedRecord.java. * Add JavaDocs to some files.
Update personal contribution to Project Portfolio Page (PPP).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall good job adding the javadocs and nice implementation for the tesing!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job adding the java docs for the methods!!
|
||
@Override | ||
public boolean equals(Object other) { | ||
if (this == other) { | ||
return true; | ||
} | ||
if (other == null || getClass() != other.getClass()) { | ||
return false; | ||
} | ||
JsonAdaptedRecord that = (JsonAdaptedRecord) other; | ||
return Objects.equals(patient, that.patient) | ||
&& Objects.equals(initialObservations, that.initialObservations) | ||
&& Objects.equals(diagnosis, that.diagnosis) | ||
&& Objects.equals(treatmentPlan, that.treatmentPlan); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(patient, initialObservations, diagnosis, treatmentPlan); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good implementation for equals
// Test with empty strings | ||
JsonAdaptedRecord jsonAdaptedRecord = new JsonAdaptedRecord( | ||
expectedPatient, "", "", ""); | ||
|
||
// Execution | ||
Record modelRecord = jsonAdaptedRecord.toModelType(); | ||
|
||
// Verification | ||
assertEquals(expectedPatient, modelRecord.getPatient()); | ||
assertEquals("", modelRecord.getInitialObservations()); | ||
assertEquals("", modelRecord.getDiagnosis()); | ||
assertEquals("", modelRecord.getTreatmentPlan()); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like how you used the comments to guide developers on the different logics of the method. Good job!
Update JsonAdaptedRecordTest
Key changes