public void testDuplicateKeysFromBytesThrowsException() throws IOException { PropertiesSettingsLoader loader = new PropertiesSettingsLoader(); try { loader.load("foo=bar\nfoo=baz".getBytes(Charset.defaultCharset())); } catch (ElasticsearchParseException e) { assertEquals( e.getMessage(), "duplicate settings key [foo] found, previous value [bar], current value [baz]"); } }
public void testDuplicateKeyFromStringThrowsException() throws IOException { PropertiesSettingsLoader loader = new PropertiesSettingsLoader(); try { loader.load("foo=bar\nfoo=baz"); fail("expected exception"); } catch (ElasticsearchParseException e) { assertEquals( e.getMessage(), "duplicate settings key [foo] found, previous value [bar], current value [baz]"); } }