ReplaceResourcePropertyValuesRegex extends ReplaceResourcePropertyValues { @Override protected String getNewValue(String propertyValue) { return propertyValue.replaceAll(searchRegex, replacement); } ReplaceResourcePropertyValuesRegex(String searchRegex, String replacement, List<String> propertyNames);   }
@Test public void getNewValue() { ReplaceResourcePropertyValues action = new ReplaceResourcePropertyValuesRegex(OLD_VAL, NEW_VAL, Arrays.asList()); assertEquals("newVal", action.getNewValue("oldVal")); assertEquals("1newVal", action.getNewValue("1oldVal")); assertEquals("newVal1", action.getNewValue("oldVal1")); assertEquals("1newVal1", action.getNewValue("1oldVal1")); assertEquals("1newVal11newVal1", action.getNewValue("1oldVal11oldVal1")); }
@Test public void getNewValue_matcherGroup() { ReplaceResourcePropertyValues action = new ReplaceResourcePropertyValuesRegex("(" + OLD_VAL + ")", NEW_VAL + "-$1", Arrays.asList()); assertEquals("newVal-oldVal", action.getNewValue("oldVal")); assertEquals("newVal-oldVal#newVal-oldVal", action.getNewValue("oldVal#oldVal")); }