lucene 4: fix TokenFilterTests

This commit is contained in:
Igor Motov 2012-11-05 08:05:17 -05:00 committed by Shay Banon
parent 98eb97a1ff
commit f8842d5a4f
2 changed files with 2 additions and 0 deletions

View File

@ -49,6 +49,7 @@ public class TruncateTokenFilterTests {
}; };
TokenStream test = analyzer.tokenStream("test", new StringReader("a bb ccc dddd eeeee")); TokenStream test = analyzer.tokenStream("test", new StringReader("a bb ccc dddd eeeee"));
test.reset();
CharTermAttribute termAttribute = test.addAttribute(CharTermAttribute.class); CharTermAttribute termAttribute = test.addAttribute(CharTermAttribute.class);
assertThat(test.incrementToken(), equalTo(true)); assertThat(test.incrementToken(), equalTo(true));
assertThat(termAttribute.toString(), equalTo("a")); assertThat(termAttribute.toString(), equalTo("a"));

View File

@ -49,6 +49,7 @@ public class UniqueTokenFilterTests {
}; };
TokenStream test = analyzer.tokenStream("test", new StringReader("this test with test")); TokenStream test = analyzer.tokenStream("test", new StringReader("this test with test"));
test.reset();
CharTermAttribute termAttribute = test.addAttribute(CharTermAttribute.class); CharTermAttribute termAttribute = test.addAttribute(CharTermAttribute.class);
assertThat(test.incrementToken(), equalTo(true)); assertThat(test.incrementToken(), equalTo(true));
assertThat(termAttribute.toString(), equalTo("this")); assertThat(termAttribute.toString(), equalTo("this"));