SimpleString implements EnhancedString { @Override public SimpleString patternToLower(Pattern p) { Matcher m = p.matcher(value); StringBuffer buf = new StringBuffer(); while (m.find()) { m.appendReplacement(buf, m.group().toLowerCase()); } m.appendTail(buf); return new SimpleString(buf.toString()); } SimpleString(String s); @Override SimpleString replaceText(Pattern p, String rText); @Override SimpleString patternToLower(Pattern p); @Override SimpleString patternToUpper(Pattern p); @Override int length(); @Override char charAt(int index); @Override CharSequence subSequence(int start, int end); @Override boolean equals(Object obj); @Override String getRaw(); @NotNull @Override String toString();  }
@Test public void testPatternToLower() { Assert.assertEquals(testSs.patternToLower(Pattern.compile("This")), new SimpleString("this is the string under test")); }