/** * @see org.openmrs.api.LocationService#retireLocation(Location, String) */ @Override public Location retireLocation(Location location, String reason) throws APIException { location.setRetired(true); location.setRetireReason(reason); return Context.getLocationService().saveLocation(location); }
/** * @see LocationValidator#validate(Object,Errors) */ @Test public void validate_shouldPassValidationIfRetiredLocationIsGivenRetiredReason() { Location location = new Location(); location.setName("County General"); location.setDescription("desc"); location.setRetired(true); location.setRetireReason("Because I don't like County General"); Errors errors = new BindException(location, "location"); new LocationValidator().validate(location, errors); Assert.assertFalse(errors.hasErrors()); }
/** * @see HibernateAdministrationDAO#validate(Object,Errors) */ @Test public void validate_shouldPassValidationForLocationClassIfFieldLengthsAreCorrect() { Location location = new Location(); location.setName("name"); location.setDescription("description"); location.setAddress1("address1"); location.setAddress2("address2"); location.setAddress3("address3"); location.setAddress4("address4"); location.setAddress5("address5"); location.setAddress6("address6"); location.setCityVillage("cityVillage"); location.setStateProvince("stateProvince"); location.setCountry("country"); location.setPostalCode("postalCode"); location.setLatitude("latitude"); location.setLongitude("longitude"); location.setCountyDistrict("countyDistrict"); location.setRetireReason("retireReason"); Errors errors = new BindException(location, "location"); dao.validate(location, errors); Assert.assertFalse(errors.hasErrors()); }
/** * @see LocationValidator#validate(Object,Errors) */ @Test public void validate_shouldPassValidationIfFieldLengthsAreCorrect() { Location location = new Location(); location.setName("name"); location.setDescription("description"); location.setAddress1("address1"); location.setAddress2("address2"); location.setAddress3("address3"); location.setAddress4("address4"); location.setAddress5("address5"); location.setAddress6("address6"); location.setCityVillage("cityVillage"); location.setStateProvince("stateProvince"); location.setCountry("country"); location.setPostalCode("postalCode"); location.setLatitude("latitude"); location.setLongitude("longitude"); location.setCountyDistrict("countyDistrict"); location.setRetireReason("retireReason"); Errors errors = new BindException(location, "location"); new LocationValidator().validate(location, errors); Assert.assertFalse(errors.hasErrors()); }
location.setLongitude(longString); location.setCountyDistrict(longString); location.setRetireReason(longString);
location.setLongitude(longString); location.setCountyDistrict(longString); location.setRetireReason(longString);