Package org.robolectric.shadows
Class ShadowNetworkInfo
- java.lang.Object
-
- org.robolectric.shadows.ShadowNetworkInfo
-
@Implements(android.net.NetworkInfo.class) public class ShadowNetworkInfo extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description ShadowNetworkInfo()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected static void__staticInitializer__()protected android.net.NetworkInfo.DetailedStategetDetailedState()protected android.net.NetworkInfo.StategetState()protected intgetSubtype()protected intgetType()protected booleanisAvailable()protected booleanisConnected()protected booleanisConnectedOrConnecting()static android.net.NetworkInfonewInstance(android.net.NetworkInfo.DetailedState detailedState, int type, int subType, boolean isAvailable, boolean isConnected)Deprecated.static android.net.NetworkInfonewInstance(android.net.NetworkInfo.DetailedState detailedState, int type, int subType, boolean isAvailable, android.net.NetworkInfo.State state)Allows developers to create aNetworkInfoinstance for testing.voidsetAvailableStatus(boolean isAvailable)Sets up the return value ofisAvailable().voidsetConnectionStatus(boolean isConnected)Deprecated.usesetConnectionStatus(NetworkInfo.State)insteadvoidsetConnectionStatus(android.net.NetworkInfo.State state)Sets up the return value ofgetState().voidsetConnectionType(int connectionType)Sets up the return value ofgetType().voidsetDetailedState(android.net.NetworkInfo.DetailedState detailedState)voidsetSubType(int subType)
-
-
-
Method Detail
-
__staticInitializer__
@Implementation protected static void __staticInitializer__()
-
newInstance
@Deprecated public static android.net.NetworkInfo newInstance(android.net.NetworkInfo.DetailedState detailedState, int type, int subType, boolean isAvailable, boolean isConnected)Deprecated.
-
newInstance
public static android.net.NetworkInfo newInstance(android.net.NetworkInfo.DetailedState detailedState, int type, int subType, boolean isAvailable, android.net.NetworkInfo.State state)Allows developers to create aNetworkInfoinstance for testing.
-
isConnected
@Implementation protected boolean isConnected()
-
isConnectedOrConnecting
@Implementation protected boolean isConnectedOrConnecting()
-
getState
@Implementation protected android.net.NetworkInfo.State getState()
-
getDetailedState
@Implementation protected android.net.NetworkInfo.DetailedState getDetailedState()
-
getType
@Implementation protected int getType()
-
getSubtype
@Implementation protected int getSubtype()
-
isAvailable
@Implementation protected boolean isAvailable()
-
setAvailableStatus
public void setAvailableStatus(boolean isAvailable)
Sets up the return value ofisAvailable().- Parameters:
isAvailable- the value thatisAvailable()will return.
-
setConnectionStatus
@Deprecated public void setConnectionStatus(boolean isConnected)
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
public void setConnectionStatus(android.net.NetworkInfo.State state)
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
public void setDetailedState(android.net.NetworkInfo.DetailedState detailedState)
-
-