tokens.add(newToken("token1", 0, 6));
tokens.add(newToken("token2", 7, 13));
tokens.add(newToken("token3", 14, 20));
tokens.add(newToken("token4", 21, 27));
TokenStream tokenStream = new CollectionTokenStream(tokens);
AdditionFilter filter = new AdditionFilter(tokenStream, "prefix_", AdditionFilter.PREFIX);
Token nextToken = new Token();
filter.next(nextToken);
assertEquals("prefix_token1", new String(nextToken.termBuffer(), 0, nextToken.termLength()));
nextToken = filter.next(nextToken);
assertEquals("prefix_token2", new String(nextToken.termBuffer(), 0, nextToken.termLength()));
nextToken = filter.next(nextToken);
assertEquals("prefix_token3", new String(nextToken.termBuffer(), 0, nextToken.termLength()));
nextToken = filter.next(nextToken);
assertEquals("prefix_token4", new String(nextToken.termBuffer(), 0, nextToken.termLength()));
tokens = new ArrayList<Token>();
tokens.add(newToken("token1", 0, 6));
tokens.add(newToken("token2", 7, 13));
tokens.add(newToken("token3", 14, 20));
tokens.add(newToken("token4", 21, 27));
tokenStream = new CollectionTokenStream(tokens);
filter = new AdditionFilter(tokenStream, "_postfix", AdditionFilter.POSTFIX);
nextToken = filter.next(nextToken);
assertEquals("token1_postfix", new String(nextToken.termBuffer(), 0, nextToken.termLength()));
nextToken = filter.next(nextToken);