@Test public void testGetCsvDataByColumn() throws IOException { List<List<String>> expectedData = Lists.newArrayList(); expectedData.add(Lists.newArrayList("a", "b", "c")); expectedData.add(Lists.newArrayList("a1", "b1", "c1")); for (int column = 0; column < 2; column++) { List<String> actualDataByColumn = CsvFiles.getCsvDataByColumn(csvStringFile.getPath(), column, headerPresent); List<String> expectedDataByColumn = expectedData.get(column); if (headerPresent) { expectedDataByColumn.remove(0); } assertEquals( "Values for column " + column + " do not match", expectedDataByColumn, actualDataByColumn); } }
public static List<String> getCsvDataByColumn(String fileName, final int column, boolean headerPresent) throws IOException { final List<String> result = Lists.newArrayList(); new CsvReader(fileName, headerPresent) .processReader((headers, line, lineNumber) -> result.add(line[column])); return result; }
CsvFiles { public static List<String> getCsvDataByColumn(String fileName, final int column, boolean headerPresent) throws IOException { final List<String> result = Lists.newArrayList(); new CsvReader(fileName, headerPresent) .processReader((headers, line, lineNumber) -> result.add(line[column])); return result; } }
CsvFiles { public static List<String> getCsvDataByColumn(String fileName, final int column, boolean headerPresent) throws IOException { final List<String> result = Lists.newArrayList(); new CsvReader(fileName, headerPresent) .processReader((headers, line, lineNumber) -> result.add(line[column])); return result; } private  CsvFiles(); }
CsvFiles { public static List<String> getCsvDataByColumn(String fileName, final int column, boolean headerPresent) throws IOException { final List<String> result = Lists.newArrayList(); new CsvReader(fileName, headerPresent) .processReader((headers, line, lineNumber) -> result.add(line[column])); return result; } private  CsvFiles(); static Map<String, String> getCsvDataMap(String fileName,
      final int key, final int value, boolean headerPresent); static Map<String, String> getCsvDataMap(String fileName, boolean headerPresent); static Map<String, String[]> getCsvDataMapArray(String fileName, boolean headerPresent); static List<Map<String, String>> getCsvDataListMap(String fileName,
      boolean headerPresent); static List<String> getCsvDataByColumn(String fileName, final int column,
      boolean headerPresent); static List<String[]> getCsvDataArray(String fileName, boolean headerPresent); static List<String[]> getCsvDataArray(Reader csvReader, boolean headerPresent); static void writeCsv(List<String[]> csvData, String fileName); }
CsvFiles { public static List<String> getCsvDataByColumn(String fileName, final int column, boolean headerPresent) throws IOException { final List<String> result = Lists.newArrayList(); new CsvReader(fileName, headerPresent) .processReader((headers, line, lineNumber) -> result.add(line[column])); return result; } private  CsvFiles(); static Map<String, String> getCsvDataMap(String fileName,
      final int key, final int value, boolean headerPresent); static Map<String, String> getCsvDataMap(String fileName, boolean headerPresent); static Map<String, String[]> getCsvDataMapArray(String fileName, boolean headerPresent); static List<Map<String, String>> getCsvDataListMap(String fileName,
      boolean headerPresent); static List<String> getCsvDataByColumn(String fileName, final int column,
      boolean headerPresent); static List<String[]> getCsvDataArray(String fileName, boolean headerPresent); static List<String[]> getCsvDataArray(Reader csvReader, boolean headerPresent); static void writeCsv(List<String[]> csvData, String fileName);  }