Ejemplo n.º 1
0
 /** blast some random strings through differently configured tokenizers */
 public void testRandomRegexps() throws Exception {
   int iters = TEST_NIGHTLY ? atLeast(30) : atLeast(1);
   for (int i = 0; i < iters; i++) {
     final CharacterRunAutomaton dfa =
         new CharacterRunAutomaton(AutomatonTestUtil.randomAutomaton(random()), Integer.MAX_VALUE);
     final boolean lowercase = random().nextBoolean();
     final int limit = TestUtil.nextInt(random(), 0, 500);
     Analyzer a =
         new Analyzer() {
           @Override
           protected TokenStreamComponents createComponents(String fieldName) {
             Tokenizer t = new MockTokenizer(dfa, lowercase, limit);
             return new TokenStreamComponents(t, t);
           }
         };
     checkRandomData(random(), a, 100);
     a.close();
   }
 }