Hallo guys
I am working on this issue Log in - OpenMRS Issues.
I cloned the Openmrs-core on my machine and without making any changes I tried to build the package by running mvn-clean-install.
But I got these two errors anyone who can help me understand them better.
Given the error it seems as though its not apparently related to the method in EncounterService causing extreme slowness nor the tests for the EncounterService that located in the org.openmrs.api.EncounterServiceTest class. But rather the errors you are seeing are from unit tests because they expected a certain result but got a different one;
HibernateAlertDAOTest.getAlerts_shouldReturnAllAlertsWhenUserIsSpecified: This test was expecting to receive 0 alerts but actually received 1.
HibernateAlertDAOTest.getAllAlerts_shouldReturnOnlyNonExpiredAllerts: This test was also expecting to receive 0 alerts but actually received 1.
You may need to investigate the code and the tests to determine what is causing the unexpected behavior.
But again if this is not related to the issue, i would suggest you provide logs for any errors or warnings related to the EncounterService and then do profiling to determine the methods and operations related to the slowness. Am not sure about the tools OpenMRS uses here but it would be important to investigate and compare the performance differences .
@jwnasambu@thembo42@dkayiwa
Hallo I worked around these errors by changing the value of the AssertEquals to 0 in the methods HibernateAlertDAOTest.getAllAlerts_shouldReturnOnlyNonExpiredAllerts() and HibernateAlertDAOTest.getAlerts_shouldReturnAllAlertsWhenUserIsSpecified().
After that I run mvn clean install and the build was successful.
Though my question is why were these methods coded to test if AssertEquals equals 1?
i doubt changing the value of the Assert statement is better solution as it may reduce the robustness of the test case in the future…
Anyway, i suppose the tests were originally written assuming that there would always be at least one alert in the test database . technically;
if there is only one alert returned by the method being tested, the expectation could be that it should not be expired or it should belong to the user that was specified.
@suubi7 Am not certain if you got a chance to look at the previous comments on the ticket especially the one made by Darius. The changes to be made are supposed to be on 2.x branch. To switch to 2.x branch on your forked repo kindly follow this steps:
git fetch --all (To fetch all branches from all remotes)
git branch --all (To list all the branches you have)
git checkout 2.x (Ensure its among the listed branches)
git checkout -b TRUNK-5362