### Question:
PlainSearchReplaceTransformer implements Transformer { @Validate public void validate() { for (final Entry<String, String> entry : replacements.entrySet()) { final String searchString = entry.getKey(); if (Strings.isNullOrEmpty(searchString)) { throw new IllegalArgumentException("Search string cannot be empty"); } final String replacementString = entry.getValue(); if (!replaceEntireString && replacementString.indexOf(searchString) != -1) { throw new IllegalArgumentException( "Replacement string cannot contain the search string (implies an infinite replacement loop)"); } } }  static void processRemovedProperties(final ComponentBuilder builder, final StringConverter stringConverter,
            final ComponentDescriptor<?> descriptor, final Map<String, String> removedProperties); static boolean isRemovedProperty(final ComponentDescriptor<?> descriptor, final String name); @Validate void validate(); @Override OutputColumns getOutputColumns(); @Override String[] transform(final InputRow row); void setReplacements(final Map<String, String> replacements); void setReplaceEntireString(final boolean replaceEntireString);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void testEmptySearchKey() throws Exception { final PlainSearchReplaceTransformer transformer = createTransformer(); transformer.replacements.put("", "foo"); transformer.validate(); }
@Test(expected = IllegalArgumentException.class) public void testRecursiveReplacement() throws Exception { final PlainSearchReplaceTransformer transformer = createTransformer(); transformer.replacements.put("foo", "foo bar foo"); transformer.validate(); }