mirror of https://github.com/apache/lucene.git
LUCENE-3726: additional tests
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1240760 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
839219831d
commit
bef6e3664d
|
@ -42,6 +42,15 @@ public class TestKuromojiAnalyzer extends BaseTokenStreamTestCase {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that search mode is enabled and working by default
|
||||
*/
|
||||
public void testDecomposition() throws IOException {
|
||||
assertAnalyzesTo(new KuromojiAnalyzer(TEST_VERSION_CURRENT), "シニアソフトウェアエンジニア",
|
||||
new String[] { "シニア", "ソフトウェア", "エンジニア" }
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* blast random strings against the analyzer
|
||||
*/
|
||||
|
|
|
@ -41,6 +41,34 @@ public class TestKuromojiTokenizerFactory extends BaseTokenTestCase {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that search mode is enabled and working by default
|
||||
*/
|
||||
public void testDefaults() throws IOException {
|
||||
KuromojiTokenizerFactory factory = new KuromojiTokenizerFactory();
|
||||
factory.init(DEFAULT_VERSION_PARAM);
|
||||
factory.inform(new SolrResourceLoader(null, null));
|
||||
TokenStream ts = factory.create(new StringReader("シニアソフトウェアエンジニア"));
|
||||
assertTokenStreamContents(ts,
|
||||
new String[] { "シニア", "ソフトウェア", "エンジニア" }
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test mode parameter: specifying normal mode
|
||||
*/
|
||||
public void testMode() throws IOException {
|
||||
KuromojiTokenizerFactory factory = new KuromojiTokenizerFactory();
|
||||
Map<String,String> args = new HashMap<String,String>();
|
||||
args.put("mode", "normal");
|
||||
factory.init(args);
|
||||
factory.inform(new SolrResourceLoader(null, null));
|
||||
TokenStream ts = factory.create(new StringReader("シニアソフトウェアエンジニア"));
|
||||
assertTokenStreamContents(ts,
|
||||
new String[] { "シニアソフトウェアエンジニア" }
|
||||
);
|
||||
}
|
||||
|
||||
public void testUserDict() throws IOException {
|
||||
String userDict =
|
||||
"# Custom segmentation for long entries\n" +
|
||||
|
|
Loading…
Reference in New Issue