Apache Lucene open-source search software
LUCENE-10300: add morfologik.tests and check if the ukrainian analyzer loads properly.
Dawid Weiss768adb99d640
diff --git a/lucene/analysis/morfologik.tests/build.gradle b/lucene/analysis/morfologik.tests/build.gradlenew file mode 100644index 00000000000..9cd6720fa1c--- /dev/null+++ b/lucene/analysis/morfologik.tests/build.gradle@@ -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"+}diff --git a/lucene/analysis/morfologik.tests/src/test/module-info.java b/lucene/analysis/morfologik.tests/src/test/module-info.javanew file mode 100644index 00000000000..15642a9421f--- /dev/null+++ b/lucene/analysis/morfologik.tests/src/test/module-info.java@@ -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;+}diff --git a/lucene/analysis/morfologik.tests/src/test/org/apache/lucene/analysis/morfologik/tests/TestMorfologikAnalyzer.java b/lucene/analysis/morfologik.tests/src/test/org/apache/lucene/analysis/morfologik/tests/TestMorfologikAnalyzer.javanew file mode 100644index 00000000000..484462eeae3--- /dev/null+++ b/lucene/analysis/morfologik.tests/src/test/org/apache/lucene/analysis/morfologik/tests/TestMorfologikAnalyzer.java@@ -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());+ }+}diff --git a/settings.gradle b/settings.gradleindex e965095654c..21583ae3546 100644--- a/settings.gradle+++ b/settings.gradle@@ -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"