On 1/8/2015 8:31 PM, TK Solr wrote:
> Is there any good document about Lucene Test Framework?
> I can only find API docs.
> Mimicking the unit test I've found in Lucene trunk, I tried to write
> a unit test that tests a TokenFilter I am writing. But it is failing
> with an error message like:
> java.lang.AssertionError: close() called in wrong state: SETREADER
>       at 
> __randomizedtesting.SeedInfo.seed([2899FF2F02A64CCB:47B7F94117CE7067]:0)
>       at 
> org.apache.lucene.analysis.MockTokenizer.close(MockTokenizer.java:261)
>       at org.apache.lucene.analysis.TokenFilter.close(TokenFilter.java:58)
> 
> During a few round of try and error, I got an error message that the Test
> Framework
> JAR has to be before Lucene Core. And the above stack trace indicates
> that the Test Framework has its own Analyzer implementation, and it has
> a certain assumption but it is not clear what the assumption is.
> 
> This exception was thrown from one of these lines, I believe:
>       TokenStream ts = deuAna.tokenStream("text", new
> StringReader(testText));
>       TokenStreamToDot tstd = new TokenStreamToDot(testText, ts, new
> PrintWriter(System.out));
>       ts.close();
> 
> (I'm not too sure what TokenStreamToDot is about. I was hoping it would
> dump a token stream.)

This question is probably more appropriate for the dev list than the
solr-user list, especially since it has more to do with Lucene than Solr.

If the javadocs for the classes you want to use are not providing enough
info, then you may be able to learn more by looking into the tests
included in the Lucene source code that use the framework classes you'd
like to try.

Thanks,
Shawn

Reply via email to