TokenOffsetPayloadTokenFilter nptf = new TokenOffsetPayloadTokenFilter(new WhitespaceTokenizer(new StringReader(test)));
int count = 0;
final Token reusableToken = new Token();
for (Token nextToken = nptf.next(reusableToken); nextToken != null; nextToken = nptf.next(reusableToken)) {
assertTrue("nextToken is null and it shouldn't be", nextToken != null);
Payload pay = nextToken.getPayload();
assertTrue("pay is null and it shouldn't be", pay != null);
byte [] data = pay.getData();
int start = PayloadHelper.decodeInt(data, 0);
assertTrue(start + " does not equal: " + nextToken.startOffset(), start == nextToken.startOffset());
int end = PayloadHelper.decodeInt(data, 4);
assertTrue(end + " does not equal: " + nextToken.endOffset(), end == nextToken.endOffset());
count++;