### Question:
IdRepoUtils { public static Map<String, ?> getAttrMapWithoutPasswordAttrs(Map<String, ?> attrMap, Set<String> pwdAttrs) { if (attrMap == null || attrMap.isEmpty()) { return attrMap; } attrMap = new CaseInsensitiveHashMap(attrMap); Set<String> allPwdAttrs = new HashSet<String>(defaultPwdAttrs); if (pwdAttrs != null) { allPwdAttrs.addAll(pwdAttrs); } AMHashMap returnAttrMap = null; for (String pwdAttr : allPwdAttrs) { if (attrMap.containsKey(pwdAttr)) { if (returnAttrMap == null) { returnAttrMap = new AMHashMap(); returnAttrMap.copy(attrMap); } returnAttrMap.put(pwdAttr, "xxx..."); } } return (returnAttrMap == null ? attrMap : returnAttrMap); }  static Map<String, ?> getAttrMapWithoutPasswordAttrs(Map<String, ?> attrMap, Set<String> pwdAttrs); static boolean hasIdRepoSchema(String idRepoType); static void loadIdRepoSchema(SSOToken ssoToken, String idRepoName,
        String realm, ServletContext servletCtx); static Map<IdType, Set<IdOperation>> parseSupportedTypesAndOperations(Set<String> typesAndOperations); static Map<String, String> parseAttributeMapping(Set<String> mappings);  }### Answer:
@Test public void filteringPasswordWorksWithDefaultSettings() { Map<String, Set<String>> values = new HashMap<String, Set<String>>(); values.put("userpassword2", asSet("test1")); values.put("auserpassword", asSet("test2")); values.put("userpassword", asSet("test3")); values.put("aunicodepwd", asSet("test4")); values.put("unicodepwd2", asSet("test5")); values.put("unicodepwd", asSet("test6")); Map<String, ?> result = IdRepoUtils.getAttrMapWithoutPasswordAttrs(values, null); assertThat(result.values()).containsOnly(asSet("test1"), asSet("test2"), asSet("test4"), asSet("test5"), "xxx..."); }
@Test public void filteringPasswordWorksCaseInsensitively() { Map<String, Set<String>> values = new HashMap<String, Set<String>>(); values.put("userpassword", asSet("test1")); values.put("uSeRpAsSwOrD", asSet("test2")); values.put("userPassword", asSet("test3")); values.put("UnIcOdEpWd", asSet("test4")); values.put("unicodePwd", asSet("test5")); values.put("unicodepwd", asSet("test6")); Map<String, ?> result = IdRepoUtils.getAttrMapWithoutPasswordAttrs(values, null); assertThat(result.values()).containsOnly("xxx..."); }
@Test public void filteringPasswordWorksWithExtraPasswordParameters() { Map<String, Set<String>> values = new HashMap<String, Set<String>>(); values.put("hello", asSet("test1")); values.put("world", asSet("test2")); values.put("userpassword", asSet("test3")); values.put("unicodepwd", asSet("test4")); values.put("hellp", asSet("test5")); values.put("worlt", asSet("test6")); Map<String, ?> result = IdRepoUtils.getAttrMapWithoutPasswordAttrs(values, asSet("HELLO", "WORLD")); assertThat(result.values()).containsOnly(asSet("test5"), asSet("test6"), "xxx..."); }