From e8d24d10dcd3c720f2bcadb5b01aa1effda37d74 Mon Sep 17 00:00:00 2001 From: Alexander Reelsen Date: Wed, 10 Feb 2016 15:29:16 +0100 Subject: [PATCH] Tests: Fix AttachmentProcessorFactoryTests to only check for existing fields --- .../attachment/AttachmentProcessorFactoryTests.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/ingest-attachment/src/test/java/org/elasticsearch/ingest/attachment/AttachmentProcessorFactoryTests.java b/plugins/ingest-attachment/src/test/java/org/elasticsearch/ingest/attachment/AttachmentProcessorFactoryTests.java index 469a0f8629e..7d48b217abf 100644 --- a/plugins/ingest-attachment/src/test/java/org/elasticsearch/ingest/attachment/AttachmentProcessorFactoryTests.java +++ b/plugins/ingest-attachment/src/test/java/org/elasticsearch/ingest/attachment/AttachmentProcessorFactoryTests.java @@ -32,6 +32,7 @@ import java.util.Locale; import java.util.Map; import java.util.Set; +import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.sameInstance; import static org.hamcrest.core.Is.is; @@ -101,8 +102,11 @@ public class AttachmentProcessorFactoryTests extends ESTestCase { factory.create(config); fail("exception expected"); } catch (ElasticsearchParseException e) { - assertThat(e.getMessage(), equalTo("[fields] illegal field option [invalid]. valid values are " + - "[CONTENT, TITLE, NAME, AUTHOR, KEYWORDS, DATE, CONTENT_TYPE, CONTENT_LENGTH, LANGUAGE]")); + assertThat(e.getMessage(), containsString("[fields] illegal field option [invalid]")); + // ensure allowed fields are mentioned + for (AttachmentProcessor.Field field : AttachmentProcessor.Field.values()) { + assertThat(e.getMessage(), containsString(field.name())); + } } config = new HashMap<>();