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.
This commit is contained in:
Jason Tedor 2016-03-23 21:27:33 -04:00
parent cf92151513
commit ca5e48d39a
1 changed files with 5 additions and 0 deletions

View File

@ -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));
}
}