@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(); }