-
Notifications
You must be signed in to change notification settings - Fork 233
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
BahmniPatientProfileResourceTest#updatePatient() fails when actually adding relationships #68
base: master
Are you sure you want to change the base?
Conversation
Update patient test fail just by adding a relationship in patient.json. The reason for failing is that PatientResource1_8 is null. Doesnt return that return from context. |
.../java/org/bahmni/module/bahmnicore/web/v1_0/controller/BahmniPatientProfileResourceTest.java
Show resolved
Hide resolved
@@ -63,6 +64,7 @@ | |||
@Mock | |||
PatientResource1_8 patientResource1_8; | |||
|
|||
|
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.
Remove this as well.
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.
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.
@Andu033 you will have to add something that returns a mock for PersonResource1_8
like it is done here for PatientResource1_8
, something like that:
PowerMockito.when(restService.getResourceBySupportedClass(Person.class))
.thenReturn(personResource1_8);
... and make sure that the mock does what it should for the tests to make sense.
Cc @rbuisson
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.
Not straighftoward to make this work. In fact the tests weren't testing anything.
I have also renamed some of the variables to make it clearer.
This is now fixed but I am still unsure why the BahmniPatientProfileResource#update
method is calling twice the patientProfile.setRelationships()
.
Line 164 in 84a9aa6
delegate.setRelationships(getRelationships(propertiesToUpdate, delegate.getPatient())); |
https://github.com/Bahmni/bahmni-core/blob/master/bahmnicore-omod/src/main/java/org/bahmni/module/bahmnicore/web/v1_0/controller/BahmniPatientProfileResource.java#L185
No description provided.