@Test public void applyPatternsShouldModifyWhenMatching() { ContentReplacer testee = new ContentReplacer(false); ImmutableList<ReplacingPattern> patterns = ImmutableList.of(new ReplacingPattern(Pattern.compile("test"), false, "TEST"), new ReplacingPattern(Pattern.compile("a"), true, "e"), new ReplacingPattern(Pattern.compile("o"), false, "o")); String value = testee.applyPatterns(patterns, "test aa o"); assertThat(value).isEqualTo("TEST ee o"); }
public String applyPatterns(List<ReplacingPattern> patterns, String text) { String textCopy = new String(text); for (ReplacingPattern replacingPattern : patterns) { textCopy = applyPattern(replacingPattern, textCopy); } return textCopy; }
ContentReplacer { public String applyPatterns(List<ReplacingPattern> patterns, String text) { String textCopy = new String(text); for (ReplacingPattern replacingPattern : patterns) { textCopy = applyPattern(replacingPattern, textCopy); } return textCopy; } }
ContentReplacer { public String applyPatterns(List<ReplacingPattern> patterns, String text) { String textCopy = new String(text); for (ReplacingPattern replacingPattern : patterns) { textCopy = applyPattern(replacingPattern, textCopy); } return textCopy; } ContentReplacer(boolean debug); }
ContentReplacer { public String applyPatterns(List<ReplacingPattern> patterns, String text) { String textCopy = new String(text); for (ReplacingPattern replacingPattern : patterns) { textCopy = applyPattern(replacingPattern, textCopy); } return textCopy; } ContentReplacer(boolean debug); String applyPatterns(List<ReplacingPattern> patterns, String text); void replaceMailContentAndSubject(Mail mail, ReplaceConfig replaceConfig, Optional<Charset> charset); }
ContentReplacer { public String applyPatterns(List<ReplacingPattern> patterns, String text) { String textCopy = new String(text); for (ReplacingPattern replacingPattern : patterns) { textCopy = applyPattern(replacingPattern, textCopy); } return textCopy; } ContentReplacer(boolean debug); String applyPatterns(List<ReplacingPattern> patterns, String text); void replaceMailContentAndSubject(Mail mail, ReplaceConfig replaceConfig, Optional<Charset> charset);  }