davidmoten commented on a change in pull request #41: [CSV-239] Add 
CSVRecord.getHeaderNames and allow duplicate headers
URL: https://github.com/apache/commons-csv/pull/41#discussion_r286704457
 
 

 ##########
 File path: src/test/java/org/apache/commons/csv/CSVParserTest.java
 ##########
 @@ -1151,6 +1166,14 @@ public void testTrim() throws Exception {
         assertEquals("3", record.get("Z"));
         Assert.assertEquals(3, record.size());
     }
+    
+    @Test
+    public void testRepeatedHeadersAreReturnedInCSVRecordHeaderNames() throws 
IOException {
+        final Reader in = new 
StringReader("header1,header2,header1\n1,2,3\n4,5,6");
+        final Iterator<CSVRecord> records = 
CSVFormat.DEFAULT.withFirstRecordAsHeader().withTrim().parse(in).iterator();
+        final CSVRecord record = records.next();
+        assertEquals(Arrays.asList("header1", "header2", "header1"), 
record.getParser().getHeaderNames());
+    }
 
 Review comment:
   Yes, when I added the tests I made sure that coverage was 100% of 
`createHeaders`. That's no guarantee that all cases are covered of course but I 
think we are ok.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to