Skip to content

Commit

Permalink
Add EnginePluginTests for getEngineFactory method
Browse files Browse the repository at this point in the history
Signed-off-by: John Mazanec <jmazane@amazon.com>
  • Loading branch information
jmazanec15 committed Mar 9, 2022
1 parent cc05bcc commit 9e10d0e
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions server/src/test/java/org/opensearch/plugins/EnginePluginTests.java
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());
}
}

0 comments on commit 9e10d0e

Please sign in to comment.