### Question:
TokenFilter { public void filterValues(Map<?, String> map) { for (Map.Entry<?, String> entry : map.entrySet()) { String value = entry.getValue(); if (value != null) entry.setValue(filter(value)); } } TokenFilter();  TokenFilter(Map<String, String> tokenValues); void setToken(String name, String value); String getToken(String name); void unsetToken(String name); Map<String, String> getTokens(); void setTokens(Map<String, String> tokens); String filter(String input); void filterValues(Map<?, String> map);  }### Answer:
@Test public void testFilterValues() { TokenFilter tokenFilter = new TokenFilter(); tokenFilter.setToken("TOKEN_A", "value-of-a"); tokenFilter.setToken("TOKEN_B", "value-of-b"); Map<Integer, String> map = new HashMap<Integer, String>(); map.put(1, "$$${NOPE}hello${TOKEN_A}world${TOKEN_B}$${NOT_A_TOKEN}"); map.put(2, "${NOPE}hello${TOKEN_A}world${TOKEN_C}"); map.put(3, null); tokenFilter.filterValues(map); assertEquals(3, map.size()); assertEquals( "$${NOPE}hellovalue-of-aworldvalue-of-b${NOT_A_TOKEN}", map.get(1) ); assertEquals( "${NOPE}hellovalue-of-aworld${TOKEN_C}", map.get(2) ); assertNull(map.get(3)); }