Search in sources :

Example 1 with DocumentMapperParser

use of org.opensearch.index.mapper.DocumentMapperParser in project OpenSearch by opensearch-project.

the class PercolatorFieldMapperTests method testEmptyName.

public void testEmptyName() throws Exception {
    String mapping = Strings.toString(XContentFactory.jsonBuilder().startObject().startObject("type1").startObject("properties").startObject("").field("type", "percolator").endObject().endObject().endObject().endObject());
    DocumentMapperParser parser = mapperService.documentMapperParser();
    IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> parser.parse("type1", new CompressedXContent(mapping)));
    assertThat(e.getMessage(), containsString("name cannot be empty string"));
}
Also used : CompressedXContent(org.opensearch.common.compress.CompressedXContent) Matchers.containsString(org.hamcrest.Matchers.containsString) DocumentMapperParser(org.opensearch.index.mapper.DocumentMapperParser)

Aggregations

Matchers.containsString (org.hamcrest.Matchers.containsString)1 CompressedXContent (org.opensearch.common.compress.CompressedXContent)1 DocumentMapperParser (org.opensearch.index.mapper.DocumentMapperParser)1