PropertyManager { public String maskValue(String key, String value) { String lowerCaseKey = ASCII.toLowerCase(key); if (lowerCaseKey.contains("password") || lowerCaseKey.contains("secret")) return "******"; return value; }  Optional<String> property(String key); String maskValue(String key, String value); final Properties properties; }
@Test void maskValue() { assertThat(propertyManager.maskValue("sys.jdbc.password", "password")).doesNotContain("password"); assertThat(propertyManager.maskValue("app.key.secret", "secret")).doesNotContain("secret"); assertThat(propertyManager.maskValue("sys.jdbc.user", "user")).isEqualTo("user"); assertThat(propertyManager.maskValue("SYS_JDBC_PASSWORD", "password")).doesNotContain("password"); }