@@ -158,7 +158,7 @@ public void testEmptyFields() throws Exception {
158158 items .keySet ().stream ().skip (numItems - 1 ).forEach (key -> assertFalse (ingestDocument .hasField (key )));
159159 }
160160
161- public void testWrongStings () throws Exception {
161+ public void testWrongStrings () throws Exception {
162162 assumeTrue ("single run only" , quote .isEmpty ());
163163 expectThrows (IllegalArgumentException .class , () -> processDocument (new String []{"a" }, "abc\" abc" ));
164164 expectThrows (IllegalArgumentException .class , () -> processDocument (new String []{"a" }, "\" abc\" asd" ));
@@ -190,6 +190,19 @@ public void testUntrimmed() throws Exception {
190190 assertFalse (document .hasField ("f" ));
191191 }
192192
193+ public void testIgnoreMissing () {
194+ assumeTrue ("single run only" , quote .isEmpty ());
195+ IngestDocument ingestDocument = RandomDocumentPicks .randomIngestDocument (random ());
196+ String fieldName = randomAlphaOfLength (5 );
197+ if (ingestDocument .hasField (fieldName )) {
198+ ingestDocument .removeField (fieldName );
199+ }
200+ CsvProcessor processor = new CsvProcessor (randomAlphaOfLength (5 ), fieldName , new String []{"a" }, false , ',' , '"' , true );
201+ processor .execute (ingestDocument );
202+ CsvProcessor processor2 = new CsvProcessor (randomAlphaOfLength (5 ), fieldName , new String []{"a" }, false , ',' , '"' , false );
203+ expectThrows (IllegalArgumentException .class , () -> processor2 .execute (ingestDocument ));
204+ }
205+
193206 public void testEmptyHeaders () throws Exception {
194207 assumeTrue ("single run only" , quote .isEmpty ());
195208 IngestDocument ingestDocument = RandomDocumentPicks .randomIngestDocument (random ());
0 commit comments