### Question:
Optimizer { static Matcher combineCharSeqAfterIndexOf(Matcher matcher) { if (matcher instanceof IndexOfMatcher) { IndexOfMatcher m = matcher.as(); Matcher next = PatternUtils.head(m.next()); if (next instanceof CharSeqMatcher) { String pattern = m.pattern() + next.<CharSeqMatcher>as().pattern(); return new IndexOfMatcher(pattern, PatternUtils.tail(m.next())); } } return matcher; } private  Optimizer();   }### Answer:
@Test public void combineCharSeqAfterIndexOf() { Matcher input = new IndexOfMatcher("ab", new CharSeqMatcher("cd")); Matcher expected = new IndexOfMatcher("abcd", TrueMatcher.INSTANCE); Assertions.assertEquals(expected, Optimizer.combineCharSeqAfterIndexOf(input)); }