### Question:
RegexLoggingFilter { public CharSequence filter(CharSequence command) { if (regPattern != null) { command = new ReplaceRegEx(regPattern, regGroup, regReplacement).filter(command); } for (ReplaceRegEx regex : regexs) { command = regex.filter(command); } return command; }  CharSequence filter(CharSequence command); void addRegEx(String pattern); void addRegEx(String pattern, int group); void addRegEx(String pattern, int group, String replacement); void addCommandOption(String option, String... commands); String getPattern(); void setPattern(String pattern); String getReplacement(); void setReplacement(String replacement); int getGroup(); void setGroup(int group); static final String DEFAULT_REPLACEMENT; }### Answer:
@Test public void testFilter() throws Exception { String wantFilter = "jms:queue:soapRequestQueue?username=admin&password=admin123."; RegexLoggingFilter filter = new RegexLoggingFilter(); filter.setPattern("jms(.*?)password=+([^ ]+)"); filter.setGroup(2); wantFilter = filter.filter(wantFilter).toString(); assertEquals(wantFilter, "jms:queue:soapRequestQueue?username=admin&password=" + RegexLoggingFilter.DEFAULT_REPLACEMENT); }