}
}
@Test
public void testGetNewName_RegexGroup() {
MatchReplaceRule rule = new MatchReplaceRule();
rule.setMatchString("(ab)");
rule.setReplaceString("-$1-");
rule.setMatchRegularExpressions(true);
rule.setReplacementLimit(ReplacementLimit.ALL);
File aaaFile = new File("ABA bab.txt");
try {
String newName = rule.getNewName(aaaFile);
assertTrue(newName.equals("-AB-A b-ab-.txt"));
} catch (IOException e) {
fail("Should not throw an exception");
e.printStackTrace();
}