LUCENE-3969: add hack for MockLookahead's asserts

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene3969@1324749 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2012-04-11 13:08:10 +00:00
parent 69fafd4791
commit 14928d42c6
1 changed files with 6 additions and 3 deletions

View File

@ -48,6 +48,7 @@ import org.apache.lucene.analysis.CharReader;
import org.apache.lucene.analysis.CharStream;
import org.apache.lucene.analysis.EmptyTokenizer;
import org.apache.lucene.analysis.MockGraphTokenFilter;
import org.apache.lucene.analysis.MockRandomLookaheadTokenFilter;
import org.apache.lucene.analysis.MockTokenFilter;
import org.apache.lucene.analysis.MockTokenizer;
import org.apache.lucene.analysis.TokenFilter;
@ -713,9 +714,11 @@ public class TestRandomChains extends BaseTokenStreamTestCase {
while (true) {
final Constructor<? extends TokenFilter> ctor = tokenfilters.get(random.nextInt(tokenfilters.size()));
// nocommit/hack: MockGraph has assertions that will trip if it follows
// an offsets violator. so we cant use it after e.g. wikipediatokenizer
if (ctor.getDeclaringClass().equals(MockGraphTokenFilter.class) && !spec.offsetsAreCorrect) {
// nocommit/hack: MockGraph/MockLookahead has assertions that will trip if they follow
// an offsets violator. so we cant use them after e.g. wikipediatokenizer
if (!spec.offsetsAreCorrect &&
(ctor.getDeclaringClass().equals(MockGraphTokenFilter.class)
|| ctor.getDeclaringClass().equals(MockRandomLookaheadTokenFilter.class))) {
continue;
}