-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add EnginePluginTests for getEngineFactory method
Signed-off-by: John Mazanec <jmazane@amazon.com>
- Loading branch information
1 parent
cc05bcc
commit 9e10d0e
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
server/src/test/java/org/opensearch/plugins/EnginePluginTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<EngineFactory> getEngineFactory(IndexSettings indexSettings) { | ||
return Optional.of(engineFactory); | ||
} | ||
}; | ||
assertEquals(engineFactory, enginePluginThatImplementsGetEngineFactory.getEngineFactory(null).orElse(null)); | ||
|
||
EnginePlugin enginePluginThatDoesNotImplementsGetEngineFactory = new EnginePlugin() { | ||
}; | ||
assertFalse(enginePluginThatDoesNotImplementsGetEngineFactory.getEngineFactory(null).isPresent()); | ||
} | ||
} |