@Test
  public void shouldConfigureFieldLengthWithLengthsOnly() {
    UniVocityFixedWidthDataFormat dataFormat =
        new UniVocityFixedWidthDataFormat().setFieldLengths(new int[] {1, 2, 3});

    assertArrayEquals(new int[] {1, 2, 3}, dataFormat.getFieldLengths());

    dataFormat.createAndConfigureWriterSettings();
  }
  @Test(expected = IllegalArgumentException.class)
  public void shouldNotAllowHeadersWithSameName() {
    UniVocityFixedWidthDataFormat dataFormat =
        new UniVocityFixedWidthDataFormat()
            .setFieldLengths(new int[] {1, 2, 3})
            .setHeaders(new String[] {"A", "B", "A"});

    assertArrayEquals(new int[] {1, 2, 3}, dataFormat.getFieldLengths());
    assertArrayEquals(new String[] {"A", "B", "A"}, dataFormat.getHeaders());

    dataFormat.createAndConfigureWriterSettings();
  }
  @Test
  public void shouldConfigureFieldLengthWithHeadersAndLengths() {
    UniVocityFixedWidthDataFormat dataFormat =
        new UniVocityFixedWidthDataFormat()
            .setFieldLengths(new int[] {1, 2, 3})
            .setHeaders(new String[] {"A", "B", "C"});

    assertArrayEquals(new int[] {1, 2, 3}, dataFormat.getFieldLengths());
    assertArrayEquals(new String[] {"A", "B", "C"}, dataFormat.getHeaders());

    dataFormat.createAndConfigureWriterSettings();
  }