You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@lucene.apache.org by us...@apache.org on 2009/09/25 19:26:12 UTC
svn commit: r818920 -
/lucene/java/trunk/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java
Author: uschindler
Date: Fri Sep 25 17:26:11 2009
New Revision: 818920
URL: http://svn.apache.org/viewvc?rev=818920&view=rev
Log:
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
Modified:
lucene/java/trunk/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java
Modified: lucene/java/trunk/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java?rev=818920&r1=818919&r2=818920&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java Fri Sep 25 17:26:11 2009
@@ -111,7 +111,13 @@
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)