@Test
public void testNfaRepetition() {

    // Test NFA matching ac*e
    NfaState c = NfaState.token("contents%word@i", "c", null);
    NfaState split = NfaState.or(true, Arrays.asList(c, NfaState.token("contents%word@i", "e", null)), false);
    NfaState start = NfaState.token("contents%word@i", "a", split);
    c.setNextState(0, split); // loopback
    start.finish(new HashSet<NfaState>());
    start.lookupPropertyNumbers(new MockFiAccessor(), new IdentityHashMap<NfaState, Boolean>());
    // Forward matching
    Assert.assertTrue(start.matches(new ForwardIndexDocumentString("access"), 0, 1));
    Assert.assertTrue(start.matches(new ForwardIndexDocumentString("aces"), 0, 1));
    Assert.assertTrue(start.matches(new ForwardIndexDocumentString("aether"), 0, 1));
    Assert.assertFalse(start.matches(new ForwardIndexDocumentString("acquire"), 0, 1));
    Assert.assertFalse(start.matches(new ForwardIndexDocumentString("cesium"), 0, 1));
    // Backward matching
    Assert.assertTrue(start.matches(new ForwardIndexDocumentString("ideaal"), 3, -1));
}