### Question:
NetworkStateTracker extends ConstraintTracker<NetworkState> { @Override public void stopTracking() { if (isNetworkCallbackSupported()) { Log.d(TAG, "Unregistering network callback"); mConnectivityManager.unregisterNetworkCallback(mNetworkCallback); } else { Log.d(TAG, "Unregistering broadcast receiver"); mAppContext.unregisterReceiver(mBroadcastReceiver); } } NetworkStateTracker(Context context); @Override NetworkState getInitialState(); @Override void startTracking(); @Override void stopTracking();  }### Answer:
@Test @SmallTest @SdkSuppress(minSdkVersion = 24) public void testStopTracking_afterApi24() { mTracker.stopTracking(); verify(mMockConnectivityManager) .unregisterNetworkCallback(any(ConnectivityManager.NetworkCallback.class)); }
@Test @SmallTest @SdkSuppress(maxSdkVersion = 23) public void testStopTracking_beforeApi24() { mTracker.stopTracking(); verify(mMockContext).unregisterReceiver(any(BroadcastReceiver.class)); }