@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()); }
protected boolean isNetworkAvailable() { final ConnectivityManager manager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); final NetworkInfo netInfo = manager.getActiveNetworkInfo(); return netInfo != null && netInfo.isConnected(); }
AbstractMapSelectionActivity extends ListActivity { protected boolean isNetworkAvailable() { final ConnectivityManager manager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); final NetworkInfo netInfo = manager.getActiveNetworkInfo(); return netInfo != null && netInfo.isConnected(); } }
AbstractMapSelectionActivity extends ListActivity { protected boolean isNetworkAvailable() { final ConnectivityManager manager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); final NetworkInfo netInfo = manager.getActiveNetworkInfo(); return netInfo != null && netInfo.isConnected(); }  }
AbstractMapSelectionActivity extends ListActivity { protected boolean isNetworkAvailable() { final ConnectivityManager manager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); final NetworkInfo netInfo = manager.getActiveNetworkInfo(); return netInfo != null && netInfo.isConnected(); }  abstract Intent getIntentWithMapName(final String mapName); }
AbstractMapSelectionActivity extends ListActivity { protected boolean isNetworkAvailable() { final ConnectivityManager manager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); final NetworkInfo netInfo = manager.getActiveNetworkInfo(); return netInfo != null && netInfo.isConnected(); }  abstract Intent getIntentWithMapName(final String mapName);  }