@Test public void shouldUnretireALocation() throws Exception { Location location = service.getLocation(3); Assert.assertTrue(location.isRetired()); String json = "{ \"retired\": false }"; MockHttpServletRequest req = request(RequestMethod.POST, getURI() + "/" + getUuid()); req.setContent(json.getBytes()); handle(req); Location updatedLocation = service.getLocationByUuid(getUuid()); Assert.assertTrue(!updatedLocation.isRetired()); }
@Test public void shouldRetireALocation() throws Exception { Location location = service.getLocation(2); Assert.assertFalse(location.isRetired()); MockHttpServletRequest req = request(RequestMethod.DELETE, getURI() + "/" + location.getUuid()); req.addParameter("!purge", ""); req.addParameter("reason", "random reason"); handle(req); Location retiredLocation = service.getLocation(2); Assert.assertTrue(retiredLocation.isRetired()); Assert.assertEquals("random reason", retiredLocation.getRetireReason()); }
@Test public void encounterLocationTag_shouldShowRetiredLocationIfPreviouslySelected() throws Exception { // create an encounter associated with a retired location Location location = Context.getLocationService().getLocation(3); Patient patient = Context.getPatientService().getPatient(2); Encounter encounter = Context.getEncounterService().getEncounter(101); // (sanity check) Assert.assertTrue(location.isRetired()); // set the location on this encounter to the retired location encounter.setLocation(location); // now render a form using that encounter HtmlForm htmlform = new HtmlForm(); htmlform.setXmlData( "<htmlform><encounterLocation /></htmlform>"); FormEntrySession session = new FormEntrySession(patient, encounter, FormEntryContext.Mode.EDIT, htmlform, null); TestUtil.assertFuzzyContains("<option value=\"3\" selected=\"true\">Never Never Land</option>", session.getHtmlToDisplay()); }
@Override public void validateFullRepresentation() throws Exception { super.validateFullRepresentation(); assertPropEquals("name", getObject().getName()); assertPropEquals("description", getObject().getDescription()); assertPropEquals("address1", getObject().getAddress1()); assertPropEquals("address2", getObject().getAddress2()); assertPropEquals("cityVillage", getObject().getCityVillage()); assertPropEquals("stateProvince", getObject().getStateProvince()); assertPropEquals("country", getObject().getCountry()); assertPropEquals("postalCode", getObject().getPostalCode()); assertPropEquals("latitude", getObject().getLatitude()); assertPropEquals("longitude", getObject().getLongitude()); assertPropEquals("countyDistrict", getObject().getCountyDistrict()); assertPropEquals("address3", getObject().getAddress3()); assertPropEquals("address4", getObject().getAddress4()); assertPropEquals("address5", getObject().getAddress5()); assertPropEquals("address6", getObject().getAddress6()); assertPropPresent("tags"); assertPropPresent("attributes"); assertPropPresent("parentLocation"); assertPropPresent("childLocations"); assertPropEquals("retired", getObject().isRetired()); assertPropPresent("auditInfo"); }
@Override public void validateDefaultRepresentation() throws Exception { super.validateDefaultRepresentation(); assertPropEquals("name", getObject().getName()); assertPropEquals("description", getObject().getDescription()); assertPropEquals("address1", getObject().getAddress1()); assertPropEquals("address2", getObject().getAddress2()); assertPropEquals("cityVillage", getObject().getCityVillage()); assertPropEquals("stateProvince", getObject().getStateProvince()); assertPropEquals("country", getObject().getCountry()); assertPropEquals("postalCode", getObject().getPostalCode()); assertPropEquals("latitude", getObject().getLatitude()); assertPropEquals("longitude", getObject().getLongitude()); assertPropEquals("countyDistrict", getObject().getCountyDistrict()); assertPropEquals("address3", getObject().getAddress3()); assertPropEquals("address4", getObject().getAddress4()); assertPropEquals("address5", getObject().getAddress5()); assertPropEquals("address6", getObject().getAddress6()); assertPropPresent("tags"); assertPropPresent("attributes"); assertPropPresent("parentLocation"); assertPropPresent("childLocations"); assertPropEquals("retired", getObject().isRetired()); }
assertPropPresent("parentLocation"); assertPropPresent("childLocations"); assertPropEquals("retired", getObject().isRetired());
assertPropPresent("parentLocation"); assertPropPresent("childLocations"); assertPropEquals("retired", getObject().isRetired()); assertPropPresent("auditInfo");