location.setAddress1(longString); location.setAddress2(longString); location.setAddress3(longString);
/** * Test to make sure that a simple save to a new location gets persisted to the database * * @see LocationService#saveLocation(Location) */ @Test public void saveLocation_shouldCreateLocationSuccessfully() { Location location = new Location(); location.setName("testing"); location.setDescription("desc"); location.setAddress1("123"); location.setAddress1("456"); location.setCityVillage("city"); location.setStateProvince("state"); location.setCountry("country"); location.setPostalCode("post"); location.setLatitude("lat"); location.setLongitude("lon"); LocationService ls = Context.getLocationService(); ls.saveLocation(location); Location newSavedLocation = ls.getLocation(location.getLocationId()); assertNotNull("The saved location should have an id now", location.getLocationId()); assertNotNull("We should get back a location", newSavedLocation); assertTrue("The created location needs to equal the pojo location", location.equals(newSavedLocation)); }
location.setName(longString); location.setDescription(longString); location.setAddress1(longString); location.setAddress2(longString); location.setAddress3(longString);
/** * @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()); }