@Test
public void testNfaSimple() {

    // Test simple NFA matching ab|ba
    NfaState ab = NfaState.token("contents%word@i", "a", NfaState.token("contents%word@i", "b", null));
    NfaState ba = NfaState.token("contents%word@i", "b", NfaState.token("contents%word@i", "a", null));
    NfaState start = NfaState.or(false, Arrays.asList(ab, ba), true);
    start.finish(new HashSet<NfaState>());
    start.lookupPropertyNumbers(new MockFiAccessor(), new IdentityHashMap<NfaState, Boolean>());
    ForwardIndexDocumentString fiDoc = new ForwardIndexDocumentString("abatoir");
    Assert.assertTrue(start.matches(fiDoc, 0, 1));
    Assert.assertTrue(start.matches(fiDoc, 1, 1));
    Assert.assertFalse(start.matches(fiDoc, 2, 1));
    Assert.assertFalse(start.matches(fiDoc, 6, 1));
}