### Question:
MapFragment extends android.support.v4.app.Fragment implements MetricsView.IMapLayerToggleListener { public void mapNetworkConnectionChanged() { FragmentActivity activity = getActivity(); if (activity == null) { return; } if (activity.getFilesDir() == null) { showMapNotAvailableMessage(NoMapAvailableMessage.eNoMapDueToNoAccessibleStorage); return; } getUrlAndInit(); final ConnectivityManager cm = (ConnectivityManager) getActivity().getSystemService(Context.CONNECTIVITY_SERVICE); final NetworkInfo info = cm.getActiveNetworkInfo(); final boolean hasNetwork = (info != null) && info.isConnected(); final boolean hasWifi = (info != null) && (info.getType() == ConnectivityManager.TYPE_WIFI); NoMapAvailableMessage message = hasNetwork ? NoMapAvailableMessage.eHideNoMapMessage : NoMapAvailableMessage.eNoMapDueToNoInternet; showMapNotAvailableMessage(message); setHighBandwidthMap(hasNetwork, hasWifi); }  @Override View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState); MainApp getApplication(); void mapNetworkConnectionChanged(); void setZoomButtonsVisible(boolean visible); @SuppressLint("NewApi") void dimToolbar(); void toggleScanning(MenuItem menuItem); void setUserPositionAt(Location location); void updateGPSInfo(int satellites, int fixes); @Override void onResume(); @Override void onSaveInstanceState(Bundle bundle); @Override void onPause(); @Override void onDestroy(); void formatTextView(int textViewId, int stringId, Object... args); void formatTextView(int textViewId, String str, Object... args); void newMLSPoint(ObservationPoint point); void newObservationPoint(ObservationPoint point); @Override void setShowMLS(boolean isOn); void showMapNotAvailableMessage(NoMapAvailableMessage noMapAvailableMessage); void showPausedDueToNoMotionMessage(boolean show); void stop(); static final int LOWEST_UNLIMITED_ZOOM; }### Answer:
@Test @Config(shadows = {CustomShadowConnectivityManager.class}) public void testMapNetworkConnectionChanged() { MapFragment mapFragment = spy(MapFragment.class); doNothing().when(mapFragment).doOnCreateView(any(Bundle.class)); doNothing().when(mapFragment).getUrlAndInit(); doNothing().when(mapFragment).setHighBandwidthMap(Mockito.anyBoolean(), Mockito.anyBoolean()); doNothing().when(mapFragment).doOnResume(); startFragment(mapFragment); mapFragment.mapNetworkConnectionChanged(); verify(mapFragment).showMapNotAvailableMessage(MapFragment.NoMapAvailableMessage.eNoMapDueToNoInternet); verify(mapFragment).setHighBandwidthMap(false, false); }