runValidation(doc, ValidationStatus.VALID);
}
@Test
public void testDelimiterValidation() {
TextDocument doc = createValidSimpleDelimitedDocument(2);
SimpleTextStructure struct = (SimpleTextStructure) doc.getDataStructure();
doc.setProperty(TextDocument.DELIMITER, null);
runValidation(doc, ValidationStatus.INVALID);
doc.setDelimiter(FieldDelimiter.NEW_LINE);
runValidation(doc, ValidationStatus.INVALID); // Invalid because the document has two fields
struct.getSegment().getFieldList().remove(0);
runValidation(doc, ValidationStatus.VALID); // Valid because now the document has only one field
doc = createValidSimpleFixedFieldDocument();
doc.setProperty(TextDocument.DELIMITER, null);
runValidation(doc, ValidationStatus.VALID); // Valid because fixed field documents do not use a delimiter
doc.setProperty(TextDocument.DELIMITER, FieldDelimiter.NEW_LINE);
runValidation(doc, ValidationStatus.VALID); // Valid because fixed field documents do not use a delimiter
}