Skip to content

Commit

Permalink
Fixed build
Browse files Browse the repository at this point in the history
(cherry picked from commit 0fee185)
  • Loading branch information
rkorytkowski committed Mar 12, 2014
1 parent b738e2f commit 1555f99
Showing 1 changed file with 2 additions and 6 deletions.
Expand Up @@ -23,7 +23,6 @@

import org.apache.commons.beanutils.BeanUtils;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.openmrs.GlobalProperty;
import org.openmrs.Patient;
Expand All @@ -43,14 +42,11 @@
import org.openmrs.web.test.WebTestHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.validation.BindException;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.support.SessionStatus;
import org.springframework.web.context.request.ServletWebRequest;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter;
import org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping;

/**
* Consists of unit tests for the ShortPatientFormController
Expand Down Expand Up @@ -545,7 +541,7 @@ public void saveShortPatient_shouldNotVoidAddressIfItWasNotChanged() throws Exce
PersonAddress personAddress = patient.getPersonAddress();

MockHttpServletRequest request = webTestHelper.newPOST("/admin/patients/shortPatientForm.form");
request.setParameter("patientId", patient.getPatientId().toString());
request.setParameter("patientId", "2");

This comment has been minimized.

Copy link
@wluyima

wluyima Mar 12, 2014

Member

I'm just curious how does this solves the issue?

This comment has been minimized.

Copy link
@rkorytkowski

rkorytkowski Mar 12, 2014

Author Member

It doesn't :/ I'm still investigating what's the issue.

This comment has been minimized.

Copy link
@dkayiwa

dkayiwa via email Mar 12, 2014

Member

This comment has been minimized.

Copy link
@wluyima

wluyima Mar 12, 2014

Member

My suspicion is that the for some reason in those tests, there is no patient with a matching patientId, so the generated shortPatientModel has no personName set on it for a new instance. The puzzling thing is that this only fails on 1.10.x yet this is the same code being run by the plan for 1.9.x and never fails. In thoe 2 tests, add some assertions instead to ensure that the patient object is not null and then we proceed on what gets printed the next time it fails

request.setParameter("personAddress.address1", personAddress.getAddress1());
request.setParameter("personAddress.countyDistrict", "");

Expand All @@ -567,7 +563,7 @@ public void saveShortPatient_shouldVoidAddressIfItWasChanged() throws Exception
PersonAddress personAddress = patient.getPersonAddress();

MockHttpServletRequest request = webTestHelper.newPOST("/admin/patients/shortPatientForm.form");
request.setParameter("patientId", patient.getPatientId().toString());
request.setParameter("patientId", "2");
request.setParameter("personAddress.address1", "new");
request.setParameter("personAddress.countyDistrict", "");

Expand Down

0 comments on commit 1555f99

Please sign in to comment.