Skip to content

Commit

Permalink
Fix unit test
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Froh <froh@amazon.com>
  • Loading branch information
msfroh committed Aug 23, 2024
1 parent b416205 commit 0a952c3
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.hamcrest.core.StringContains.containsString;

public class FlatObjectFieldMapperTests extends MapperTestCase {
private static final String FIELD_TYPE = "flat_object";
Expand Down Expand Up @@ -133,9 +132,10 @@ public void testDefaults() throws Exception {

public void testNullValue() throws IOException {
DocumentMapper mapper = createDocumentMapper(fieldMapping(this::minimalMapping));
MapperParsingException e = expectThrows(MapperParsingException.class, () -> mapper.parse(source(b -> b.nullField("field"))));
assertThat(e.getMessage(), containsString("object mapping for [_doc] tried to parse field [field] as object"));

ParsedDocument parsedDocument = mapper.parse(source(b -> b.nullField("field")));
assertEquals(1, parsedDocument.docs().size());
IndexableField[] fields = parsedDocument.rootDoc().getFields("field");
assertEquals(0, fields.length);
}

@Override
Expand Down

0 comments on commit 0a952c3

Please sign in to comment.