static void validateCsvFormat(CSVFormat format) {
    String[] header =
        checkArgumentNotNull(format.getHeader(), "Illegal %s: header is required", CSVFormat.class);

    checkArgument(header.length > 0, "Illegal %s: header cannot be empty", CSVFormat.class);

    checkArgument(
        !format.getAllowMissingColumnNames(),
        "Illegal %s: cannot allow missing column names",
        CSVFormat.class);

    checkArgument(
        !format.getIgnoreHeaderCase(), "Illegal %s: cannot ignore header case", CSVFormat.class);

    checkArgument(
        !format.getAllowDuplicateHeaderNames(),
        "Illegal %s: cannot allow duplicate header names",
        CSVFormat.class);

    for (String columnName : header) {
      checkArgument(
          !Strings.isNullOrEmpty(columnName),
          "Illegal %s: column name is required",
          CSVFormat.class);
    }
    checkArgument(
        !format.getSkipHeaderRecord(),
        "Illegal %s: cannot skip header record because the header is already accounted for",
        CSVFormat.class);
  }
@Test
  public void givenCSVFormatThatAllowsMissingColumnNames_throwsException() {
    CSVFormat format = csvFormatWithHeader().withAllowMissingColumnNames(true);
    String gotMessage =
        assertThrows(
                IllegalArgumentException.class, () -> CsvIOParseHelpers.validateCsvFormat(format))
            .getMessage();
    assertEquals(
        "Illegal class org.apache.commons.csv.CSVFormat: cannot allow missing column names",
        gotMessage);
  }