diff --git a/core/src/test/java/org/elasticsearch/indices/template/SimpleIndexTemplateIT.java b/core/src/test/java/org/elasticsearch/indices/template/SimpleIndexTemplateIT.java index b32cfef76b6..4a85b97fde4 100644 --- a/core/src/test/java/org/elasticsearch/indices/template/SimpleIndexTemplateIT.java +++ b/core/src/test/java/org/elasticsearch/indices/template/SimpleIndexTemplateIT.java @@ -321,21 +321,25 @@ public class SimpleIndexTemplateIT extends ESIntegTestCase { GetIndexTemplatesResponse response = client().admin().indices().prepareGetTemplates().get(); assertThat(response.getIndexTemplates(), empty()); - client().admin().indices().preparePutTemplate("template_1") + try { + client().admin().indices().preparePutTemplate("template_1") .setTemplate("te*") .setSettings(Settings.builder().put("does_not_exist", "test")) .get(); + fail(); + } catch (IllegalArgumentException ex) { + assertEquals("unknown setting [does_not_exist]", ex.getMessage()); + } response = client().admin().indices().prepareGetTemplates().get(); assertThat(response.getIndexTemplates(), hasSize(1)); assertThat(response.getIndexTemplates().get(0).getSettings().getAsMap().size(), equalTo(1)); - assertThat(response.getIndexTemplates().get(0).getSettings().get("index.does_not_exist"), equalTo("test")); + assertNull(response.getIndexTemplates().get(0).getSettings().get("index.does_not_exist")); createIndex("test"); - //the wrong setting has no effect but does get stored among the index settings GetSettingsResponse getSettingsResponse = client().admin().indices().prepareGetSettings("test").get(); - assertThat(getSettingsResponse.getIndexToSettings().get("test").getAsMap().get("index.does_not_exist"), equalTo("test")); + assertNull(getSettingsResponse.getIndexToSettings().get("test").getAsMap().get("index.does_not_exist")); } public void testIndexTemplateWithAliases() throws Exception {