From bd3c3848119e84c831c10e372294691e1b9b66a8 Mon Sep 17 00:00:00 2001 From: Jim Ferenczi Date: Tue, 16 Apr 2024 09:12:39 +0100 Subject: [PATCH] fix warning message in tests --- .../index/mapper/DynamicFieldMapperTests.java | 5 +---- .../index/mapper/DynamicTemplatesTests.java | 11 ++++------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/server/src/test/java/org/elasticsearch/index/mapper/DynamicFieldMapperTests.java b/server/src/test/java/org/elasticsearch/index/mapper/DynamicFieldMapperTests.java index 69811fc6ef27..19f0bc6d4921 100644 --- a/server/src/test/java/org/elasticsearch/index/mapper/DynamicFieldMapperTests.java +++ b/server/src/test/java/org/elasticsearch/index/mapper/DynamicFieldMapperTests.java @@ -27,7 +27,6 @@ import static org.hamcrest.Matchers.instanceOf; public class DynamicFieldMapperTests extends ESSingleNodeTestCase { - @Override protected Collection> getPlugins() { return List.of(NonDynamicFieldPlugin.class); @@ -204,9 +203,7 @@ protected String contentType() { } @Override - protected void parseCreateField(DocumentParserContext context) throws IOException { - - } + protected void parseCreateField(DocumentParserContext context) throws IOException {} @Override public FieldMapper.Builder getMergeBuilder() { diff --git a/server/src/test/java/org/elasticsearch/index/mapper/DynamicTemplatesTests.java b/server/src/test/java/org/elasticsearch/index/mapper/DynamicTemplatesTests.java index 0f285992b749..2c6c013eb613 100644 --- a/server/src/test/java/org/elasticsearch/index/mapper/DynamicTemplatesTests.java +++ b/server/src/test/java/org/elasticsearch/index/mapper/DynamicTemplatesTests.java @@ -244,15 +244,12 @@ public void testDynamicMapperWithBadMapping() throws IOException { } b.endArray(); })); - assertWarnings(""" - dynamic template [test] has invalid content [{"match_mapping_type":"string","mapping":{"badparam":false}}], \ - attempted to validate it with the following match_mapping_type: [string], last error: \ - [unknown parameter [badparam] on mapper [__dynamic__test] of type [null]]"""); - + assertWarnings( + "Parameter [badparam] is used in a dynamic template mapping and has no effect on type [null]. Usage will result in an error in future major versions and should be removed." + ); mapper.parse(source(b -> b.field("field", "foo"))); assertWarnings( - "Parameter [badparam] is used in a dynamic template mapping and has no effect on type [null]. " - + "Usage will result in an error in future major versions and should be removed." + "Parameter [badparam] is used in a dynamic template mapping and has no effect on type [null]. Usage will result in an error in future major versions and should be removed." ); }