Package org.robolectric.shadows
Class ShadowGeocoder
java.lang.Object
org.robolectric.shadows.ShadowGeocoder
@Implements(android.location.Geocoder.class) public final class ShadowGeocoder extends Object
-
Constructor Summary
Constructors Constructor Description ShadowGeocoder()
-
Method Summary
Modifier and Type Method Description protected List<Address>
getFromLocation(double latitude, double longitude, int maxResults)
Returns an empty list by default, or the last value set bysetFromLocation(List)
protected void
getFromLocation(double latitude, double longitude, int maxResults, Geocoder.GeocodeListener listener)
Sets an empty list by default, or the last value set bysetFromLocation(List)
in the providedlistener
protected static boolean
isPresent()
static void
reset()
void
setFromLocation(List<Address> list)
Sets the value to be returned byGeocoder.getFromLocation(double, double, int)
.static void
setIsPresent(boolean value)
Sets the value to be returned byGeocoder.isPresent()
.
-
Constructor Details
-
ShadowGeocoder
public ShadowGeocoder()
-
-
Method Details
-
isPresent
- Returns:
- true by default, or the value specified via
setIsPresent(boolean)
-
getFromLocation
@Implementation protected List<Address> getFromLocation(double latitude, double longitude, int maxResults) throws IOExceptionReturns an empty list by default, or the last value set bysetFromLocation(List)
{@param latitude} and {@param longitude} are ignored by this implementation, except to check that they are in appropriate bounds. {@param maxResults} determines the maximum number of addresses to return.
- Throws:
IOException
-
getFromLocation
@Implementation(minSdk=33) protected void getFromLocation(double latitude, double longitude, int maxResults, Geocoder.GeocodeListener listener) throws IOExceptionSets an empty list by default, or the last value set bysetFromLocation(List)
in the providedlistener
latitude
andlongitude
are ignored by this implementation, except to check that they are in appropriate bounds.maxResults
determines the maximum number of addresses to return.- Throws:
IOException
-
setIsPresent
public static void setIsPresent(boolean value)Sets the value to be returned byGeocoder.isPresent()
.This value is reset to true for each test.
-
setFromLocation
Sets the value to be returned byGeocoder.getFromLocation(double, double, int)
. -
reset
-