CSVResult { public List<String> getHeaders() { return headers; } CSVResult(List<String> headers, List<String> lines);  CSVResult(String separator, List<String> headers, List<List<String>> lines); List<String> getHeaders(); List<String> getLines();  }
@Test public void getHeadersShouldReturnHeadersSanitized() { CSVResult csv = csv(headers("name", "=age"), lines(line("John", "30"))); assertEquals( headers("name", "'=age"), csv.getHeaders() ); }
@Test public void getHeadersShouldReturnHeadersQuotedIfRequired() { CSVResult csv = csv(headers("na,me", ",,age"), lines(line("John", "30"))); assertEquals( headers("\"na,me\"", "\",,age\""), csv.getHeaders() ); }
@Test public void getHeadersShouldReturnHeadersBothSanitizedAndQuotedIfRequired() { CSVResult csv = csv(headers("na,+me", ",,,=age", "=city,"), lines(line("John", "30", "Seattle"))); assertEquals( headers("\"na,+me\"", "\",,,=age\"", "\"'=city,\""), csv.getHeaders() ); }