@Test
public void testIsNetWorkAvailableReturnsFalseWhenNoNetworkIsAvailable() {

    final AbstractMapSelectionActivity activitySpy = spy(activity);
    final ConnectivityManager manager = mock(ConnectivityManager.class);
    final NetworkInfo networkInfo = mock(NetworkInfo.class);
    when(activitySpy.getSystemService(Context.CONNECTIVITY_SERVICE)).thenReturn(manager);
    when(manager.getActiveNetworkInfo()).thenReturn(networkInfo);
    when(networkInfo.isConnected()).thenReturn(false);
    assertFalse(activitySpy.isNetworkAvailable());
}