Skip to content

Commit

Permalink
error message names
Browse files Browse the repository at this point in the history
  • Loading branch information
romseygeek committed Jun 16, 2021
1 parent 8deac31 commit b22257e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public void testCopyToIsNotSupported() throws IOException {
b.field("copy_to", "target");
});
MapperParsingException exception = expectThrows(MapperParsingException.class, () -> createMapperService(mapping));
assertThat(exception.getMessage(), containsString("unknown parameter [copy_to] on mapper"));
assertThat(exception.getMessage(), containsString("unknown parameter [copy_to] on runtime field"));
}

public void testMultiFieldsIsNotSupported() throws IOException {
Expand All @@ -116,7 +116,7 @@ public void testMultiFieldsIsNotSupported() throws IOException {
b.startObject("fields").startObject("test").field("type", "keyword").endObject().endObject();
});
MapperParsingException exception = expectThrows(MapperParsingException.class, () -> createMapperService(mapping));
assertThat(exception.getMessage(), containsString("unknown parameter [fields] on mapper"));
assertThat(exception.getMessage(), containsString("unknown parameter [fields] on runtime field"));
}

public void testStoredScriptsAreNotSupported() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ public void testIllegalDynamicTemplateUnknownAttributeRuntime() throws Exception
assertEquals("Failed to parse mapping: dynamic template [my_template] has invalid content [" +
"{\"match_mapping_type\":\"string\",\"runtime\":{\"foo\":\"bar\",\"type\":\"keyword\"}}], " +
"attempted to validate it with the following match_mapping_type: [string]", e.getMessage());
assertEquals("unknown parameter [foo] on mapper [__dynamic__my_template] of type [keyword]", e.getRootCause().getMessage());
assertEquals("unknown parameter [foo] on runtime field [__dynamic__my_template] of type [keyword]", e.getRootCause().getMessage());
}

public void testIllegalDynamicTemplateInvalidAttribute() throws Exception {
Expand Down Expand Up @@ -497,7 +497,7 @@ public void testIllegalDynamicTemplateNoMappingTypeRuntime() throws Exception {
assertThat(e.getMessage(), containsString("Failed to parse mapping: dynamic template [my_template] has invalid content ["));
assertThat(e.getMessage(), containsString("attempted to validate it with the following match_mapping_type: " +
"[string, long, double, boolean, date]"));
assertEquals("unknown parameter [foo] on mapper [__dynamic__my_template] of type [date]", e.getRootCause().getMessage());
assertEquals("unknown parameter [foo] on runtime field [__dynamic__my_template] of type [date]", e.getRootCause().getMessage());
}

public void testIllegalDynamicTemplate7DotXIndex() throws Exception {
Expand Down Expand Up @@ -680,7 +680,7 @@ public void testRuntimeSectionWrongFormat() throws IOException {
public void testRuntimeSectionRemainingField() throws IOException {
XContentBuilder mapping = runtimeFieldMapping(builder -> builder.field("type", "keyword").field("unsupported", "value"));
MapperParsingException e = expectThrows(MapperParsingException.class, () -> createMapperService(mapping));
assertEquals("Failed to parse mapping: unknown parameter [unsupported] on mapper [field] of type [keyword]", e.getMessage());
assertEquals("Failed to parse mapping: unknown parameter [unsupported] on runtime field [field] of type [keyword]", e.getMessage());
}

public void testTemplateWithoutMatchPredicates() throws Exception {
Expand Down

0 comments on commit b22257e

Please sign in to comment.