@Test public void shouldMaskSystemProperties() { assertThat(SystemProperties .maskSystemProperties(ImmutableMap.of("test", "one"), ImmutableList.<String>of()) .get("test")).isEqualTo("one"); assertThat(SystemProperties.maskSystemProperties(ImmutableMap.of("test", "one"), ImmutableList.<String>of("test")).get("test")).isEqualTo("****"); assertThat(SystemProperties .maskSystemProperties(ImmutableMap.of("test", "one"), ImmutableList.<String>of("t")) .get("test")).isEqualTo("one"); assertThat(SystemProperties.maskSystemProperties(ImmutableMap.of("test", "one"), ImmutableList.<String>of("t*")).get("test")).isEqualTo("****"); assertThat(SystemProperties.maskSystemProperties(ImmutableMap.of("test", "one"), ImmutableList.<String>of("e*")).get("test")).isEqualTo("one"); assertThat(SystemProperties.maskSystemProperties(ImmutableMap.of("test", "one"), ImmutableList.<String>of("*t*")).get("test")).isEqualTo("****"); assertThat(SystemProperties.maskSystemProperties(ImmutableMap.of("test", "one"), ImmutableList.<String>of("*x*")).get("test")).isEqualTo("one"); assertThat(SystemProperties.maskSystemProperties(ImmutableMap.of("tEst", "one"), ImmutableList.<String>of("teSt")).get("tEst")).isEqualTo("****"); }
public static Map<String, String> maskSystemProperties(Map<String, String> systemProperties, List<String> maskSystemProperties) { if (maskSystemProperties.isEmpty()) { return systemProperties; } List<Pattern> maskPatterns = buildPatternList(maskSystemProperties); Map<String, String> maskedSystemProperties = Maps.newHashMap(); for (Map.Entry<String, String> entry : systemProperties.entrySet()) { String name = entry.getKey(); if (matchesAny(name, maskPatterns)) { maskedSystemProperties.put(name, "****"); } else { maskedSystemProperties.put(name, entry.getValue()); } } return maskedSystemProperties; }
SystemProperties { public static Map<String, String> maskSystemProperties(Map<String, String> systemProperties, List<String> maskSystemProperties) { if (maskSystemProperties.isEmpty()) { return systemProperties; } List<Pattern> maskPatterns = buildPatternList(maskSystemProperties); Map<String, String> maskedSystemProperties = Maps.newHashMap(); for (Map.Entry<String, String> entry : systemProperties.entrySet()) { String name = entry.getKey(); if (matchesAny(name, maskPatterns)) { maskedSystemProperties.put(name, "****"); } else { maskedSystemProperties.put(name, entry.getValue()); } } return maskedSystemProperties; } }
SystemProperties { public static Map<String, String> maskSystemProperties(Map<String, String> systemProperties, List<String> maskSystemProperties) { if (maskSystemProperties.isEmpty()) { return systemProperties; } List<Pattern> maskPatterns = buildPatternList(maskSystemProperties); Map<String, String> maskedSystemProperties = Maps.newHashMap(); for (Map.Entry<String, String> entry : systemProperties.entrySet()) { String name = entry.getKey(); if (matchesAny(name, maskPatterns)) { maskedSystemProperties.put(name, "****"); } else { maskedSystemProperties.put(name, entry.getValue()); } } return maskedSystemProperties; } private  SystemProperties(); }
SystemProperties { public static Map<String, String> maskSystemProperties(Map<String, String> systemProperties, List<String> maskSystemProperties) { if (maskSystemProperties.isEmpty()) { return systemProperties; } List<Pattern> maskPatterns = buildPatternList(maskSystemProperties); Map<String, String> maskedSystemProperties = Maps.newHashMap(); for (Map.Entry<String, String> entry : systemProperties.entrySet()) { String name = entry.getKey(); if (matchesAny(name, maskPatterns)) { maskedSystemProperties.put(name, "****"); } else { maskedSystemProperties.put(name, entry.getValue()); } } return maskedSystemProperties; } private  SystemProperties(); static List<String> maskJvmArgs(List<String> jvmArgs,
            List<String> maskSystemProperties); static Map<String, String> maskSystemProperties(Map<String, String> systemProperties,
            List<String> maskSystemProperties); }
SystemProperties { public static Map<String, String> maskSystemProperties(Map<String, String> systemProperties, List<String> maskSystemProperties) { if (maskSystemProperties.isEmpty()) { return systemProperties; } List<Pattern> maskPatterns = buildPatternList(maskSystemProperties); Map<String, String> maskedSystemProperties = Maps.newHashMap(); for (Map.Entry<String, String> entry : systemProperties.entrySet()) { String name = entry.getKey(); if (matchesAny(name, maskPatterns)) { maskedSystemProperties.put(name, "****"); } else { maskedSystemProperties.put(name, entry.getValue()); } } return maskedSystemProperties; } private  SystemProperties(); static List<String> maskJvmArgs(List<String> jvmArgs,
            List<String> maskSystemProperties); static Map<String, String> maskSystemProperties(Map<String, String> systemProperties,
            List<String> maskSystemProperties);  }