IndexSearcher searcher = newSearcher(reader);
TermPositions pos = searcher.getIndexReader().termPositions(new Term("field", "1"));
pos.next();
// first token should be at position 0
assertEquals(0, pos.nextPosition());
pos = searcher.getIndexReader().termPositions(new Term("field", "2"));
pos.next();
// second token should be at position 2
assertEquals(2, pos.nextPosition());