@Test public void shouldHideSecretsInToString() { ConfigMap configMap = new ConfigMap("apps.appOne", Map.of( "apps.appOne.clientId", "abc", "apps.appOne.clientSecret", "my-secret", "apps.appTwo.clientId", "xyz" )); assertThat(configMap.toString()) .contains("clientId=abc") .contains("clientSecret=****") .doesNotContain("my-secret") .doesNotContain("xyz"); }
@Override public String toString() { String values = entrySet().stream().map(this::toString).collect(Collectors.joining(", ")); return "ConfigMap{prefix=" + prefix + ", values={" + values + "}}"; }
ConfigMap extends AbstractMap<String, String> { @Override public String toString() { String values = entrySet().stream().map(this::toString).collect(Collectors.joining(", ")); return "ConfigMap{prefix=" + prefix + ", values={" + values + "}}"; } }
ConfigMap extends AbstractMap<String, String> { @Override public String toString() { String values = entrySet().stream().map(this::toString).collect(Collectors.joining(", ")); return "ConfigMap{prefix=" + prefix + ", values={" + values + "}}"; } ConfigMap(String prefix, Map<String, String> innerMap);  ConfigMap(Map<String, String> innerMap);  ConfigMap();  ConfigMap(Properties properties); }
ConfigMap extends AbstractMap<String, String> { @Override public String toString() { String values = entrySet().stream().map(this::toString).collect(Collectors.joining(", ")); return "ConfigMap{prefix=" + prefix + ", values={" + values + "}}"; } ConfigMap(String prefix, Map<String, String> innerMap);  ConfigMap(Map<String, String> innerMap);  ConfigMap();  ConfigMap(Properties properties); static ConfigMap read(File file); Optional<String> optional(Object key); @Override String get(Object key); @Override String getOrDefault(Object key, String defaultValue); boolean getBoolean(String key); @Override @NonNull Set<Entry<String, String>> entrySet(); Collection<String> listSubMaps(); ConfigMap getRoot(); Optional<ConfigMap> subMap(String prefix); @Override String toString(); }
ConfigMap extends AbstractMap<String, String> { @Override public String toString() { String values = entrySet().stream().map(this::toString).collect(Collectors.joining(", ")); return "ConfigMap{prefix=" + prefix + ", values={" + values + "}}"; } ConfigMap(String prefix, Map<String, String> innerMap);  ConfigMap(Map<String, String> innerMap);  ConfigMap();  ConfigMap(Properties properties); static ConfigMap read(File file); Optional<String> optional(Object key); @Override String get(Object key); @Override String getOrDefault(Object key, String defaultValue); boolean getBoolean(String key); @Override @NonNull Set<Entry<String, String>> entrySet(); Collection<String> listSubMaps(); ConfigMap getRoot(); Optional<ConfigMap> subMap(String prefix); @Override String toString();  }