diff --git a/server/src/test/java/org/opensearch/plugins/EnginePluginTests.java b/server/src/test/java/org/opensearch/plugins/EnginePluginTests.java new file mode 100644 index 0000000000000..19b392a0251d9 --- /dev/null +++ b/server/src/test/java/org/opensearch/plugins/EnginePluginTests.java @@ -0,0 +1,33 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.plugins; + +import org.opensearch.index.IndexSettings; +import org.opensearch.index.engine.EngineFactory; +import org.opensearch.test.OpenSearchTestCase; + +import java.util.Optional; + +public class EnginePluginTests extends OpenSearchTestCase { + + public void testGetEngineFactory() { + final EngineFactory engineFactory = config -> null; + EnginePlugin enginePluginThatImplementsGetEngineFactory = new EnginePlugin() { + @Override + public Optional getEngineFactory(IndexSettings indexSettings) { + return Optional.of(engineFactory); + } + }; + assertEquals(engineFactory, enginePluginThatImplementsGetEngineFactory.getEngineFactory(null).orElse(null)); + + EnginePlugin enginePluginThatDoesNotImplementsGetEngineFactory = new EnginePlugin() { + }; + assertFalse(enginePluginThatDoesNotImplementsGetEngineFactory.getEngineFactory(null).isPresent()); + } +}