You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2013/07/03 16:39:06 UTC

svn commit: r1499422 - in /lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous: TestScandinavianFoldingFilter.java TestScandinavianNormalizationFilter.java

Author: rmuir
Date: Wed Jul  3 14:39:06 2013
New Revision: 1499422

URL: http://svn.apache.org/r1499422
Log:
add tests

Modified:
    lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestScandinavianFoldingFilter.java
    lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestScandinavianNormalizationFilter.java

Modified: lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestScandinavianFoldingFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestScandinavianFoldingFilter.java?rev=1499422&r1=1499421&r2=1499422&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestScandinavianFoldingFilter.java (original)
+++ lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestScandinavianFoldingFilter.java Wed Jul  3 14:39:06 2013
@@ -17,7 +17,12 @@ package org.apache.lucene.analysis.misce
  * limitations under the License.
  */
 
-import org.apache.lucene.analysis.*;
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.BaseTokenStreamTestCase;
+import org.apache.lucene.analysis.MockTokenizer;
+import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.analysis.Tokenizer;
+import org.apache.lucene.analysis.core.KeywordTokenizer;
 
 import java.io.Reader;
 
@@ -100,7 +105,22 @@ public class TestScandinavianFoldingFilt
     checkOneTerm(analyzer, "Oe", "O");
     checkOneTerm(analyzer, "OO", "O");
     checkOneTerm(analyzer, "OE", "O");
-
-
+  }
+  
+  /** check that the empty string doesn't cause issues */
+  public void testEmptyTerm() throws Exception {
+    Analyzer a = new Analyzer() {
+      @Override
+      protected TokenStreamComponents createComponents(String fieldName, Reader reader) {
+        Tokenizer tokenizer = new KeywordTokenizer(reader);
+        return new TokenStreamComponents(tokenizer, new ScandinavianFoldingFilter(tokenizer));
+      } 
+    };
+    checkOneTerm(a, "", "");
+  }
+  
+  /** blast some random strings through the analyzer */
+  public void testRandomData() throws Exception {
+    checkRandomData(random(), analyzer, 1000*RANDOM_MULTIPLIER);
   }
 }

Modified: lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestScandinavianNormalizationFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestScandinavianNormalizationFilter.java?rev=1499422&r1=1499421&r2=1499422&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestScandinavianNormalizationFilter.java (original)
+++ lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestScandinavianNormalizationFilter.java Wed Jul  3 14:39:06 2013
@@ -17,7 +17,12 @@ package org.apache.lucene.analysis.misce
  * limitations under the License.
  */
 
-import org.apache.lucene.analysis.*;
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.BaseTokenStreamTestCase;
+import org.apache.lucene.analysis.MockTokenizer;
+import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.analysis.Tokenizer;
+import org.apache.lucene.analysis.core.KeywordTokenizer;
 
 import java.io.Reader;
 
@@ -99,8 +104,22 @@ public class TestScandinavianNormalizati
     checkOneTerm(analyzer, "Oe", "Ø");
     checkOneTerm(analyzer, "OO", "Ø");
     checkOneTerm(analyzer, "OE", "Ø");
-
-
   }
-
+  
+  /** check that the empty string doesn't cause issues */
+  public void testEmptyTerm() throws Exception {
+    Analyzer a = new Analyzer() {
+      @Override
+      protected TokenStreamComponents createComponents(String fieldName, Reader reader) {
+        Tokenizer tokenizer = new KeywordTokenizer(reader);
+        return new TokenStreamComponents(tokenizer, new ScandinavianNormalizationFilter(tokenizer));
+      } 
+    };
+    checkOneTerm(a, "", "");
+  }
+  
+  /** blast some random strings through the analyzer */
+  public void testRandomData() throws Exception {
+    checkRandomData(random(), analyzer, 1000*RANDOM_MULTIPLIER);
+  }
 }