Tests: Fix AttachmentProcessorFactoryTests to only check for existing fields

This commit is contained in:
Alexander Reelsen 2016-02-10 15:29:16 +01:00
parent fb7723c186
commit e8d24d10dc
1 changed files with 6 additions and 2 deletions

View File

@ -32,6 +32,7 @@ import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.sameInstance; import static org.hamcrest.Matchers.sameInstance;
import static org.hamcrest.core.Is.is; import static org.hamcrest.core.Is.is;
@ -101,8 +102,11 @@ public class AttachmentProcessorFactoryTests extends ESTestCase {
factory.create(config); factory.create(config);
fail("exception expected"); fail("exception expected");
} catch (ElasticsearchParseException e) { } catch (ElasticsearchParseException e) {
assertThat(e.getMessage(), equalTo("[fields] illegal field option [invalid]. valid values are " + assertThat(e.getMessage(), containsString("[fields] illegal field option [invalid]"));
"[CONTENT, TITLE, NAME, AUTHOR, KEYWORDS, DATE, CONTENT_TYPE, CONTENT_LENGTH, LANGUAGE]")); // ensure allowed fields are mentioned
for (AttachmentProcessor.Field field : AttachmentProcessor.Field.values()) {
assertThat(e.getMessage(), containsString(field.name()));
}
} }
config = new HashMap<>(); config = new HashMap<>();