@@ -158,7 +158,7 @@ public void testEmptyFields() throws Exception {
158
158
items .keySet ().stream ().skip (numItems - 1 ).forEach (key -> assertFalse (ingestDocument .hasField (key )));
159
159
}
160
160
161
- public void testWrongStings () throws Exception {
161
+ public void testWrongStrings () throws Exception {
162
162
assumeTrue ("single run only" , quote .isEmpty ());
163
163
expectThrows (IllegalArgumentException .class , () -> processDocument (new String []{"a" }, "abc\" abc" ));
164
164
expectThrows (IllegalArgumentException .class , () -> processDocument (new String []{"a" }, "\" abc\" asd" ));
@@ -190,6 +190,19 @@ public void testUntrimmed() throws Exception {
190
190
assertFalse (document .hasField ("f" ));
191
191
}
192
192
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
+
193
206
public void testEmptyHeaders () throws Exception {
194
207
assumeTrue ("single run only" , quote .isEmpty ());
195
208
IngestDocument ingestDocument = RandomDocumentPicks .randomIngestDocument (random ());
0 commit comments