LUCENE-10300: add morfologik.tests and check if the ukrainian analyzer loads properly.

This commit is contained in:
Dawid Weiss 2021-12-10 12:20:49 +01:00
parent 600d8345f8
commit 768adb99d6
4 changed files with 105 additions and 0 deletions

View File

@ -0,0 +1,28 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
apply plugin: 'java-library'
description = 'Module tests for :lucene:analysis:morfologik'
dependencies {
moduleTestImplementation project(':lucene:analysis:morfologik')
moduleTestImplementation("junit:junit", {
exclude group: "org.hamcrest"
})
moduleTestImplementation "org.hamcrest:hamcrest"
}

View File

@ -0,0 +1,27 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/** Test module for {@code org.apache.lucene.analysis.morfologik}. */
@SuppressWarnings({"requires-automatic"})
module org.apache.lucene.analysis.morfologik.tests {
requires org.apache.lucene.core;
requires org.apache.lucene.analysis.common;
requires org.apache.lucene.analysis.morfologik;
requires junit;
exports org.apache.lucene.analysis.morfologik.tests;
}

View File

@ -0,0 +1,49 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.analysis.morfologik.tests;
import org.apache.lucene.analysis.morfologik.MorfologikAnalyzer;
import org.apache.lucene.analysis.uk.UkrainianMorfologikAnalyzer;
import org.apache.lucene.index.IndexWriter;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
public class TestMorfologikAnalyzer {
@Test
public void testMorfologikAnalyzerLoads() {
var analyzer = new MorfologikAnalyzer();
Assert.assertNotNull(analyzer);
}
@Test
@Ignore("LUCENE-10300: Awaits fix - does not work in module mode.")
public void testUkrainianMorfologikAnalyzerLoads() {
var analyzer = new UkrainianMorfologikAnalyzer();
Assert.assertNotNull(analyzer);
}
@Test
public void testWeAreModule() {
Assert.assertTrue(this.getClass().getModule().isNamed());
}
@Test
public void testLuceneIsAModule() {
Assert.assertTrue(IndexWriter.class.getModule().isNamed());
}
}

View File

@ -30,6 +30,7 @@ include "lucene:analysis:common"
include "lucene:analysis:icu"
include "lucene:analysis:kuromoji"
include "lucene:analysis:morfologik"
include "lucene:analysis:morfologik.tests"
include "lucene:analysis:nori"
include "lucene:analysis:opennlp"
include "lucene:analysis:phonetic"