TokenStream stream = new WhitespaceTokenizer(
new StringReader("short toolong evenmuchlongertext a ab toolong foo"));
LengthFilter filter = new LengthFilter(stream, 2, 6);
assertEquals("short", filter.next().termText());
assertEquals("ab", filter.next().termText());
assertEquals("foo", filter.next().termText());
assertNull(filter.next());