protected List<Country> populateCountries() { return countryService.findCountries(); }
@Test(groups = "findCountryByShortName", dependsOnGroups = "createCountry") public void findCountryByShortName() { Country country = countryService.findCountryByAbbreviation("US"); assert country != null; }
public void createCountry() { Country country = new CountryImpl(); country.setAbbreviation("US"); country.setName("United States"); countryService.save(country); ISOCountry isoCountry = new ISOCountryImpl(); isoCountry.setAlpha2("US"); isoCountry.setName("UNITED STATES"); isoService.save(isoCountry); }
country.setName("United States"); countryService.save(country);
@Override public void setAsText(String text) { if (StringUtils.isNotEmpty(text)) { Country country = countryService.findCountryByAbbreviation(text); setValue(country); } else { setValue(null); } } });
public List<Country> getCountryOptions() { return countryService.findCountries(); }
country.setName("United States"); country = countryService.save(country);
public void createState() { State state = new StateImpl(); state.setAbbreviation("KY"); state.setName("Kentucky"); state.setCountry(countryService.findCountryByAbbreviation("US")); stateService.save(state); }
@Test(groups = "findCountries", dependsOnGroups = "createCountry") public void findCountries() { List<Country> countries = countryService.findCountries(); assert countries.size() > 0; }
country.setName("United States"); country = countryService.save(country);
/** * This method only exists because so many other tests depend on it, but should be removed once tests are more isolated * @param customerAddress */ @Deprecated @Test(groups = "createCustomerAddress", dataProvider = "setupCustomerAddress", dataProviderClass = CustomerAddressDataProvider.class, dependsOnGroups = {"readCustomer", "createCountry", "createState"}) @Transactional @Rollback(false) public void createCustomerAddress(CustomerAddress customerAddress) { userName = "customer1"; Customer customer = customerService.readCustomerByUsername(userName); assert customerAddress.getId() == null; customerAddress.setCustomer(customer); State state = stateService.findStateByAbbreviation("KY"); customerAddress.getAddress().setState(state); Country country = countryService.findCountryByAbbreviation("US"); customerAddress.getAddress().setCountry(country); customerAddress.getAddress().setIsoCountrySubdivision("US-KY"); ISOCountry isoCountry = isoService.findISOCountryByAlpha2Code("US"); customerAddress.getAddress().setIsoCountryAlpha2(isoCountry); customerAddress = customerAddressService.saveCustomerAddress(customerAddress); assert customer.equals(customerAddress.getCustomer()); userId = customerAddress.getCustomer().getId(); }
/** * Renders the add address form during the multiship process * * @param request * @param response * @param model * @return the return path */ public String showMultishipAddAddress(HttpServletRequest request, HttpServletResponse response, Model model) { model.addAttribute("states", stateService.findStates()); model.addAttribute("countries", countryService.findCountries()); model.addAttribute("countrySubdivisions", countrySubdivisionService.findSubdivisions()); return getMultishipAddAddressView(); }
/** * Saves a customerAddress with state KY and country US. Requires that createCountry() and createState() have been called * @param customerAddress */ public CustomerAddress saveCustomerAddress(CustomerAddress customerAddress) { State state = stateService.findStateByAbbreviation("KY"); customerAddress.getAddress().setState(state); Country country = countryService.findCountryByAbbreviation("US"); customerAddress.getAddress().setCountry(country); customerAddress.getAddress().setIsoCountrySubdivision("US-KY"); ISOCountry isoCountry = isoService.findISOCountryByAlpha2Code("US"); customerAddress.getAddress().setIsoCountryAlpha2(isoCountry); return customerAddressService.saveCustomerAddress(customerAddress); }
newModelVars.put("countries", countryService.findCountries()); newModelVars.put("expirationMonths", populateExpirationMonths()); newModelVars.put("expirationYears", populateExpirationYears());
ISOCountry isoCountry = null; if (dto.getAddressCountryCode() != null) { country = countryService.findCountryByAbbreviation(dto.getAddressCountryCode()); isoCountry = isoService.findISOCountryByAlpha2Code(dto.getAddressCountryCode());
@ManagedBean @ViewScoped public class Bean{ @Inject private CountryService countryService; public List<Country> getCountries(){ return countryService.findCountries(); } }
address.setPrimaryPhone("972-978-9067"); address.setState(stateService.findStateByAbbreviation("KY")); address.setCountry(countryService.findCountryByAbbreviation("US")); address.setIsoCountrySubdivision("US-KY"); address.setIsoCountryAlpha2(isoService.findISOCountryByAlpha2Code("US"));