From ea21ee88a0ed5d4e4480c733337ee4ce38808531 Mon Sep 17 00:00:00 2001 From: Craig Perkins Date: Fri, 22 Mar 2024 11:38:47 -0400 Subject: [PATCH] Add test for default value of false Signed-off-by: Craig Perkins --- .../main/java/org/opensearch/common/util/FeatureFlags.java | 2 +- .../java/org/opensearch/common/util/FeatureFlagTests.java | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/org/opensearch/common/util/FeatureFlags.java b/server/src/main/java/org/opensearch/common/util/FeatureFlags.java index ee0e67e41edde..a9a078acff1f0 100644 --- a/server/src/main/java/org/opensearch/common/util/FeatureFlags.java +++ b/server/src/main/java/org/opensearch/common/util/FeatureFlags.java @@ -102,7 +102,7 @@ public class FeatureFlags { .put(DATETIME_FORMATTER_CACHING_SETTING.getKey(), DATETIME_FORMATTER_CACHING_SETTING.getDefault(Settings.EMPTY)) .put(WRITEABLE_REMOTE_INDEX_SETTING.getKey(), WRITEABLE_REMOTE_INDEX_SETTING.getDefault(Settings.EMPTY)) .put(PLUGGABLE_CACHE_SETTING.getKey(), PLUGGABLE_CACHE_SETTING.getDefault(Settings.EMPTY)) - .build();; + .build(); /** * This method is responsible to map settings from opensearch.yml to local stored diff --git a/server/src/test/java/org/opensearch/common/util/FeatureFlagTests.java b/server/src/test/java/org/opensearch/common/util/FeatureFlagTests.java index 5e95ac2e865b0..0fc4ddd15e5bd 100644 --- a/server/src/test/java/org/opensearch/common/util/FeatureFlagTests.java +++ b/server/src/test/java/org/opensearch/common/util/FeatureFlagTests.java @@ -12,6 +12,7 @@ import org.opensearch.test.OpenSearchTestCase; import static org.opensearch.common.util.FeatureFlags.DATETIME_FORMATTER_CACHING; +import static org.opensearch.common.util.FeatureFlags.IDENTITY; public class FeatureFlagTests extends OpenSearchTestCase { @@ -41,4 +42,10 @@ public void testBooleanFeatureFlagWithDefaultSetToTrue() { assertNotNull(testFlag); assertTrue(FeatureFlags.isEnabled(testFlag)); } + + public void testBooleanFeatureFlagWithDefaultSetToFalse() { + final String testFlag = IDENTITY; + assertNotNull(testFlag); + assertFalse(FeatureFlags.isEnabled(testFlag)); + } }