From ca5e48d39aa00577221d3993978a96e9a45ac61b Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Wed, 23 Mar 2016 21:27:33 -0400 Subject: [PATCH] Test that NoDuplicatesProperties throws for null value This commit adds a test that NoDuplicatesProperties throws a NullPointerException if an attempt is made to put a key that corresponds to a null value. This behavior ultimately comes from the super class Properties but the test ensures that we retain this behavior. --- .../settings/loader/PropertiesSettingsLoaderTests.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/src/test/java/org/elasticsearch/common/settings/loader/PropertiesSettingsLoaderTests.java b/core/src/test/java/org/elasticsearch/common/settings/loader/PropertiesSettingsLoaderTests.java index bbeadfd1a87..ab96f763a88 100644 --- a/core/src/test/java/org/elasticsearch/common/settings/loader/PropertiesSettingsLoaderTests.java +++ b/core/src/test/java/org/elasticsearch/common/settings/loader/PropertiesSettingsLoaderTests.java @@ -49,4 +49,9 @@ public class PropertiesSettingsLoaderTests extends ESTestCase { assertEquals(e.getMessage(), "duplicate settings key [foo] found, previous value [bar], current value [baz]"); } + public void testThatNoDuplicatesPropertiesDoesNotAcceptNullValues() { + PropertiesSettingsLoader.NoDuplicatesProperties properties = loader.new NoDuplicatesProperties(); + expectThrows(NullPointerException.class, () -> properties.put("key", null)); + } + }