### Question:
ConfigGetParameterHandler { public Map<String, FirebaseRemoteConfigValue> getAll() { Set<String> keySet = new HashSet<>(); keySet.addAll(getKeySetFromCache(activatedConfigsCache)); keySet.addAll(getKeySetFromCache(defaultConfigsCache)); HashMap<String, FirebaseRemoteConfigValue> allConfigs = new HashMap<>(); for (String key : keySet) { allConfigs.put(key, getValue(key)); } return allConfigs; } ConfigGetParameterHandler(
      ConfigCacheClient activatedConfigsCache, ConfigCacheClient defaultConfigsCache); String getString(String key); boolean getBoolean(String key); byte[] getByteArray(String key); double getDouble(String key); long getLong(String key); FirebaseRemoteConfigValue getValue(String key); Set<String> getKeysByPrefix(String prefix); Map<String, FirebaseRemoteConfigValue> getAll(); @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE)
  static final Charset FRC_BYTE_ARRAY_ENCODING; }### Answer:
@Test public void getAll_activatedAndDefaultsConfigsDoNotExist_returnsEmptyMap() { loadCacheWithConfig(mockActivatedCache, null); loadCacheWithConfig(mockDefaultsCache, null); Map<String, FirebaseRemoteConfigValue> configs = getHandler.getAll(); assertThat(configs.keySet()).isEmpty(); }
@Test public void getAll_activatedKeyExistsAndNoDefaultsConfigs_returnsActivatedValues() throws Exception { loadActivatedCacheWithMap(ImmutableMap.of("pre11", "activated_foo", "pre21", "activated_bar")); loadCacheWithConfig(mockDefaultsCache, null); Map<String, FirebaseRemoteConfigValue> configs = getHandler.getAll(); assertThat(configs.keySet()).isEqualTo(ImmutableSet.of("pre11", "pre21")); assertThat(configs.get("pre11").asString()).isEqualTo("activated_foo"); assertThat(configs.get("pre21").asString()).isEqualTo("activated_bar"); }
@Test public void getAll_noActivatedConfigsButDefaultsKeysExist_returnsDefaultsValuess() throws Exception { loadCacheWithConfig(mockActivatedCache, null); loadDefaultsCacheWithMap(ImmutableMap.of("pre11", "default_foo", "pre21", "default_bar")); Map<String, FirebaseRemoteConfigValue> configs = getHandler.getAll(); assertThat(configs.keySet()).isEqualTo(ImmutableSet.of("pre11", "pre21")); assertThat(configs.get("pre11").asString()).isEqualTo("default_foo"); assertThat(configs.get("pre21").asString()).isEqualTo("default_bar"); }
@Test public void getAll_activatedAndDefaultKeysExist_returnsCorrectlyPrioritizedValues() throws Exception { loadActivatedCacheWithMap(ImmutableMap.of("pre11", "activated_foo")); loadDefaultsCacheWithMap(ImmutableMap.of("pre11", "default_foo", "pre21", "default_bar")); Map<String, FirebaseRemoteConfigValue> configs = getHandler.getAll(); assertThat(configs.keySet()).containsAtLeastElementsIn(ImmutableSet.of("pre11", "pre21")); assertThat(configs.get("pre11").asString()).isEqualTo("activated_foo"); assertThat(configs.get("pre21").asString()).isEqualTo("default_bar"); }