### Question:
SimpleRegexReplacer implements StandardizationPolicy { public Object convertRawValue(Object value) { if (accepts(value)) { return String.valueOf(convertValue(value.toString())); } return value; } SimpleRegexReplacer(@PolicyPropertyRef(name = "Regex Pattern") String regex,
                               @PolicyPropertyRef(name = "Replacement") String replace); @Override String convertValue(String value); Pattern getPattern(); String getReplacement(); boolean isValid(); Boolean accepts(Object value); Object convertRawValue(Object value);  }### Answer:
@Test public void testConvertRawValueValidType() { Object expectedValue = "barfeebarfie"; Object rawValue = "foofeefoofie"; SimpleRegexReplacer regexReplacer = new SimpleRegexReplacer("(?i)foo", "bar"); assertEquals(expectedValue, regexReplacer.convertRawValue(rawValue)); }
@Test public void testConvertRawValueInvalidType() { Object expectedValue = Double.valueOf("1000.05"); Object rawValue = Double.valueOf("1000.05"); SimpleRegexReplacer regexReplacer = new SimpleRegexReplacer("[0-8]", "9"); assertEquals(expectedValue, regexReplacer.convertRawValue(rawValue)); }