AC-476 Updated PatientDAO for room including six tests#682
AC-476 Updated PatientDAO for room including six tests#682f4ww4z merged 2 commits intoopenmrs:masterfrom
Conversation
added tests for PatientRoomDAO Updated PatientDAO for room including six tests
Codecov Report
@@ Coverage Diff @@
## master #682 +/- ##
=======================================
Coverage 12.59% 12.59%
=======================================
Files 232 232
Lines 10643 10643
Branches 991 991
=======================================
Hits 1340 1340
Misses 9222 9222
Partials 81 81
Continue to review full report at Codecov.
|
f4ww4z
left a comment
There was a problem hiding this comment.
@rishabh-997 See my comments below.
| Assert.assertEquals(patientEntities.get(1).getPhoto(),expectedPatientEntity2.getPhoto()); | ||
| Assert.assertEquals(patientEntities.get(1).getPostalCode(),expectedPatientEntity2.getPostalCode()); | ||
| Assert.assertEquals(patientEntities.get(1).getState(),expectedPatientEntity2.getState()); | ||
| Assert.assertEquals(patientEntities.get(1).isSynced(),expectedPatientEntity2.isSynced()); |
There was a problem hiding this comment.
@rishabh-997 It's easier to check the equality of the objects, like:
Assert.assertEquals(patientEntities.get(0), expectedPatientEntity1);
Assert.assertEquals(patientEntities.get(1), expectedPatientEntity2);| Assert.assertEquals(patientEntities.get(0).getPhoto(),expectedPatientEntity2.getPhoto()); | ||
| Assert.assertEquals(patientEntities.get(0).getPostalCode(),expectedPatientEntity2.getPostalCode()); | ||
| Assert.assertEquals(patientEntities.get(0).getState(),expectedPatientEntity2.getState()); | ||
| Assert.assertEquals(patientEntities.get(0).isSynced(),expectedPatientEntity2.isSynced()); |
There was a problem hiding this comment.
Same here. Assert.assertEquals(patientEntities.get(0), expectedPatientEntity2);
| Assert.assertEquals(patientEntities.get(0).getPhoto(),expectedPatientEntity1.getPhoto()); | ||
| Assert.assertEquals(patientEntities.get(0).getPostalCode(),expectedPatientEntity1.getPostalCode()); | ||
| Assert.assertEquals(patientEntities.get(0).getState(),expectedPatientEntity1.getState()); | ||
| Assert.assertEquals(patientEntities.get(0).isSynced(),expectedPatientEntity1.isSynced()); |
| Assert.assertEquals(patientEntities.get(0).getPhoto(),expectedPatientEntity1.getPhoto()); | ||
| Assert.assertEquals(patientEntities.get(0).getPostalCode(),expectedPatientEntity1.getPostalCode()); | ||
| Assert.assertEquals(patientEntities.get(0).getState(),expectedPatientEntity1.getState()); | ||
| Assert.assertEquals(patientEntities.get(0).isSynced(),expectedPatientEntity1.isSynced()); |
|
|
||
| @Override | ||
| public void onSuccess(List<PatientEntity> patientEntities) { | ||
| Assert.assertEquals(patientEntities.size(),1); |
There was a problem hiding this comment.
| Assert.assertEquals(patientEntities.size(),1); | |
| Assert.assertEquals(patientEntities.size(), 1); |
| Assert.assertEquals(patientEntities.size(),1); | ||
|
|
||
| Assert.assertEquals(patientEntities.get(0).getGivenName(),"Rishabh"); | ||
| Assert.assertEquals(patientEntities.get(0).getFamilyName(),"Agarwal"); |
There was a problem hiding this comment.
Needs a space for correct formatting too.
| }); | ||
| } | ||
|
|
||
| private EncounterEntity getEncounterEntity(Long id, String uuid, String display, String visitKeyId, |
There was a problem hiding this comment.
Rename this to newEncounterEntity
| return encounterEntity; | ||
| } | ||
|
|
||
| private PatientEntity getPatientEntity(long id, String uuid, String display, |
There was a problem hiding this comment.
| private PatientEntity getPatientEntity(long id, String uuid, String display, | |
| private PatientEntity newPatientEntity(long id, String uuid, String display, |
Description of what I changed
Updated PatientDAO for room including six tests
Issue I worked on
JIRA Issue: https://issues.openmrs.org/browse/AC-476
Checklist: I completed these to help reviewers :)
(the number above, next to the 'Commits' tab is 1).
existing code that was well tested you do not have to add tests)