### Question:
PersistentStatsHandler implements NetworkRequestStatsHandler { @VisibleForTesting String getNetworkKey(NetworkInfo networkInfo) { if (networkInfo != null && networkInfo.getTypeName() != null) { if (networkInfo.getTypeName().equals(WIFI_NETWORK)) { return WIFI_NETWORK + "_" + getWifiSSID(); } else if (networkInfo.getTypeName().equals(MOBILE_NETWORK)) { return MOBILE_NETWORK + "_" + networkInfo.getSubtypeName(); } return UNKNOWN_NETWORK; } return UNKNOWN_NETWORK; } PersistentStatsHandler(Context context); @VisibleForTesting  PersistentStatsHandler(Context context, PreferenceManager preferenceManager); NetworkInfo getActiveNetworkInfo(); void addListener(OnResponseListener onResponseListener); void removeListener(OnResponseListener onResponseListener); void setMaxSizeForPersistence(int size); float getAverageNetworkSpeed(); ConnectionQuality getConnectionQuality(); @Override void onResponseReceived(final RequestStats requestStats); @Override void onHttpExchangeError(RequestStats requestStats, IOException e); @Override void onResponseInputStreamError(RequestStats requestStats, Exception e);  }### Answer:
@Test public void testGetNetworkKey() { ConnectivityManager connectivityManager = (ConnectivityManager) RuntimeEnvironment.application.getSystemService(Context.CONNECTIVITY_SERVICE); ShadowConnectivityManager shadowConnectivityManager = (ShadowConnectivityManager) ShadowExtractor.extract(connectivityManager); shadowConnectivityManager.setNetworkInfo(ConnectivityManager.TYPE_WIFI, connectivityManager.getActiveNetworkInfo()); PersistentStatsHandler persistentStatsHandler = new PersistentStatsHandler(RuntimeEnvironment.application); Assert.assertTrue(persistentStatsHandler.getNetworkKey(shadowConnectivityManager.getActiveNetworkInfo()) != null); }