ExternalResources { public void register(OnExternalResourcesChangeListener listener) { Logger.v(TAG, "Register listener:" + listener.getClass().getSimpleName()); listeners.add(listener); } private  ExternalResources(@NonNull Context context, @NonNull Converter converter,
      @NonNull Url url, @NonNull Options options, @Cache.Policy int cachePolicy,
      @Logger.Level int logLevel, @NonNull Resources defaultResources,
      @Nullable OnExternalResourcesLoadFailedListener failedListener,
      boolean useApplicationResources); @SuppressWarnings("ConstantConditions") static ExternalResources initialize(
      @NonNull Context context, Url url); @SuppressWarnings("ConstantConditions") static ExternalResources initialize(
      @NonNull Context context, @NonNull String baseUrl); @SuppressWarnings("ConstantConditions") static ExternalResources initialize(
      @NonNull ExternalResources externalResources); static ExternalResources getInstance(); void onConfigurationChanged(Configuration newConfig); boolean getBoolean(@BoolRes int resId); boolean getBoolean(@NonNull String key); @ColorInt int getColor(@ColorRes int resId); @ColorInt int getColor(@NonNull String key); float getDimension(@DimenRes int resId); float getDimension(@NonNull String key); String getString(@StringRes int resId); String getString(@NonNull String key); String getString(@StringRes int resId, Object... formatArgs); String getString(@NonNull String key, Object... formatArgs); String[] getStringArray(@ArrayRes int resId); String[] getStringArray(@NonNull String key); int getInteger(@IntegerRes int resId); int getInteger(@NonNull String key); int[] getIntArray(@ArrayRes int resId); int[] getIntArray(@NonNull String key); void register(OnExternalResourcesChangeListener listener); void unregister(OnExternalResourcesChangeListener listener); void removeFailListener(); static final String TAG; }
@Test public void testRegister() throws Exception { assertEquals(externalResources.listeners.size(), 0); externalResources.register(new OnExternalResourcesChangeListener() { @Override public void onExternalResourcesChange(ExternalResources externalResources) { } }); assertEquals(externalResources.listeners.size(), 1); }