@Test public void testRemoveListener() { OnResponseListener onResponseListener = mock(OnResponseListener.class); PersistentStatsHandler persistentStatsHandler = new PersistentStatsHandler(RuntimeEnvironment.application); persistentStatsHandler.addListener(onResponseListener); Assert.assertTrue(persistentStatsHandler.mOnResponseListeners.size() == 1); persistentStatsHandler.removeListener(onResponseListener); Assert.assertTrue(persistentStatsHandler.mOnResponseListeners.size() == 0); }
public void removeListener(OnResponseListener onResponseListener) { if (mOnResponseListeners != null) { mOnResponseListeners.remove(onResponseListener); } }
PersistentStatsHandler implements NetworkRequestStatsHandler { public void removeListener(OnResponseListener onResponseListener) { if (mOnResponseListeners != null) { mOnResponseListeners.remove(onResponseListener); } } }
PersistentStatsHandler implements NetworkRequestStatsHandler { public void removeListener(OnResponseListener onResponseListener) { if (mOnResponseListeners != null) { mOnResponseListeners.remove(onResponseListener); } } PersistentStatsHandler(Context context); @VisibleForTesting  PersistentStatsHandler(Context context, PreferenceManager preferenceManager); }
PersistentStatsHandler implements NetworkRequestStatsHandler { public void removeListener(OnResponseListener onResponseListener) { if (mOnResponseListeners != null) { mOnResponseListeners.remove(onResponseListener); } } 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); }
PersistentStatsHandler implements NetworkRequestStatsHandler { public void removeListener(OnResponseListener onResponseListener) { if (mOnResponseListeners != null) { mOnResponseListeners.remove(onResponseListener); } } 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);  }