Package org.robolectric.shadows
Class ShadowNetworkInfo
java.lang.Object
org.robolectric.shadows.ShadowNetworkInfo
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected static void
protected NetworkInfo.DetailedState
protected NetworkInfo.State
getState()
protected int
protected int
getType()
protected boolean
protected boolean
protected boolean
static NetworkInfo
newInstance
(NetworkInfo.DetailedState detailedState, int type, int subType, boolean isAvailable, boolean isConnected) Deprecated.static NetworkInfo
newInstance
(NetworkInfo.DetailedState detailedState, int type, int subType, boolean isAvailable, NetworkInfo.State state) Allows developers to create aNetworkInfo
instance for testing.void
setAvailableStatus
(boolean isAvailable) Sets up the return value ofisAvailable()
.void
setConnectionStatus
(boolean isConnected) Deprecated.usesetConnectionStatus(NetworkInfo.State)
insteadvoid
Sets up the return value ofgetState()
.void
setConnectionType
(int connectionType) Sets up the return value ofgetType()
.void
setDetailedState
(NetworkInfo.DetailedState detailedState) void
setExtraInfo
(String extraInfo) void
setSubType
(int subType)
-
Constructor Details
-
ShadowNetworkInfo
public ShadowNetworkInfo()
-
-
Method Details
-
__staticInitializer__
-
newInstance
@Deprecated public static NetworkInfo newInstance(NetworkInfo.DetailedState detailedState, int type, int subType, boolean isAvailable, boolean isConnected) Deprecated. -
newInstance
public static NetworkInfo newInstance(NetworkInfo.DetailedState detailedState, int type, int subType, boolean isAvailable, NetworkInfo.State state) Allows developers to create aNetworkInfo
instance for testing. -
isConnected
-
isConnectedOrConnecting
-
getState
-
getDetailedState
-
getType
-
getSubtype
-
isAvailable
-
setAvailableStatus
public void setAvailableStatus(boolean isAvailable) Sets up the return value ofisAvailable()
.- Parameters:
isAvailable
- the value thatisAvailable()
will return.
-
setConnectionStatus
Deprecated.usesetConnectionStatus(NetworkInfo.State)
insteadSets up the return value ofisConnectedOrConnecting()
,isConnected()
, andgetState()
. If the input is true, state will beNetworkInfo.State.CONNECTED
, else it will beNetworkInfo.State.DISCONNECTED
.- Parameters:
isConnected
- the value thatisConnectedOrConnecting()
andisConnected()
will return.
-
setConnectionStatus
Sets up the return value ofgetState()
.- Parameters:
state
- the value thatgetState()
will return.
-
setConnectionType
public void setConnectionType(int connectionType) Sets up the return value ofgetType()
.- Parameters:
connectionType
- the value thatgetType()
will return.
-
setSubType
public void setSubType(int subType) -
setDetailedState
-
setExtraInfo
-
newInstance(NetworkInfo.DetailedState, int, int, boolean, NetworkInfo.State)
instead