LUCENE-1926: a more improved version of the test to also fill the attributes with bogus values. This should e.g. detect bugs with position increment not correctly set in all cases

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@818920 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2009-09-25 17:26:11 +00:00
parent b0706ed6b6
commit c390d49290
1 changed files with 7 additions and 1 deletions

View File

@ -111,7 +111,13 @@ public abstract class BaseTokenStreamTestCase extends LuceneTestCase {
ts.reset();
for (int i = 0; i < output.length; i++) {
ts.clearAttributes(); // extra safety to enforce, that the state is not preserved
// extra safety to enforce, that the state is not preserved and also assign bogus values
ts.clearAttributes();
termAtt.setTermBuffer("bogusTerm");
if (offsetAtt != null) offsetAtt.setOffset(14584724,24683243);
if (typeAtt != null) typeAtt.setType("bogusType");
if (posIncrAtt != null) posIncrAtt.setPositionIncrement(45987657);
assertTrue("token "+i+" exists", ts.incrementToken());
assertEquals("term "+i, output[i], termAtt.term());
if (startOffsets != null)