lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r818920 - /lucene/java/trunk/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java
Date Fri, 25 Sep 2009 17:26:12 GMT
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)



Mime
View raw message