### Question:
CharsReplacer { public static Set<String> generatePasswords(String word, Map<Character, char[]> replacer) { if (word == null) { throw new IllegalArgumentException("Input word should be not null"); } if (replacer == null) { throw new IllegalArgumentException("Input replacer should be not null"); } Set<String> passwords = new HashSet<>(); passwords.add(word); generatePasswords(word, replacer, 0, passwords); return passwords; }  static Set<String> generatePasswords(String word, Map<Character, char[]> replacer);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void testGeneratePasswordsNullWord() { generatePasswords(null, replacer); }
@Test(expected = IllegalArgumentException.class) public void testGeneratePasswordsNullReplacer() { generatePasswords("ab", null); }
@Test public void testGeneratePasswords1() { Set<String> actual = generatePasswords("z", replacer); Set<String> expected = new HashSet<>(singletonList("z")); assertThat(actual, is(expected)); }
@Test public void testGeneratePasswords2() { Set<String> actual = generatePasswords("e", replacer); Set<String> expected = new HashSet<>(asList("e", "9", "0")); assertThat(actual, is(expected)); }
@Test public void testGeneratePasswords3() { Set<String> actual = generatePasswords("xey", replacer); Set<String> expected = new HashSet<>(asList("xey", "x9y", "x0y")); assertThat(actual, is(expected)); }
@Test public void testGeneratePasswords4() { Set<String> actual = generatePasswords("ab", replacer); Set<String> expected = new HashSet<>(asList("ab", "1b", "2b", "a3", "a4", "13", "14", "23", "24")); assertThat(actual, is(expected)); }
@Test public void testGeneratePasswords5() { Set<String> actual = generatePasswords("azb", replacer); Set<String> expected = new HashSet<>(asList("azb", "1zb", "2zb", "az3", "az4", "1z3", "1z4", "2z3", "2z4")); assertThat(actual, is(expected)); }