@Test
public void test() throws Exception
{

    DfaBuilder<JavaToken> builder = new DfaBuilder<>();
    for (JavaToken tok : JavaToken.values())
    {
        builder.addPattern(tok.m_pattern, tok);
    }
    StringSearcher<JavaToken> searcher = builder.buildStringSearcher(null);
    String instr = _readResource("SearcherTestInput.txt");
    String want = _readResource("SearcherTestOutput.txt");
    String have = searcher.findAndReplace(instr, StringSearcherTest::tokenReplace);
    Assert.assertEquals(want, have);
}