Code example for Address

Methods: setAddressLine, setAdminArea, setCountryCode, setLocality, setPostalCode

0
        this.lastLongitude = longitude;
        if (shouldSimulateGeocodeException) {
            throw new IOException("Simulated geocode exception");
        } 
        Address address = makeAddress();
        address.setAddressLine(0, addressLine1);
        address.setLocality(city);
        address.setAdminArea(state);
        address.setPostalCode(zip);
        address.setCountryCode(countryCode);
        return oneElementList(address);
    } 
 
    @Implementation 
    public List<Address> getFromLocationName(String locationName, int maxResults) throws IOException {
        didResolution = true;
        this.lastLocationName = locationName;
        if (shouldSimulateGeocodeException) {
            throw new IOException("Simulated geocode exception");
        } 
        if (returnNoResults) {
            return new ArrayList<Address>();
        } else { 
            Address address = makeAddress();
            address.setLatitude(simulatedLatitude);
            address.setLongitude(simulatedLongitude);
            return oneElementList(address);
        } 
    } 
 
    private Address makeAddress() {
        Address address = new Address(Locale.getDefault());
        shadowOf(address).setSimulatedHasLatLong(hasLatitude, hasLongitude);
        return address;
    } 
 
    /**