### Question:
CsvFiles { public static List<String[]> getCsvDataArray(String fileName, boolean headerPresent) throws IOException { final List<String[]> result = Lists.newArrayList(); new CsvReader(fileName, headerPresent) .processReader((headers, line, lineNumber) -> result.add(line)); 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);  }### Answer:
@Test public void testGetCsvDataArray() throws IOException { List<String[]> actualDataList = CsvFiles.getCsvDataArray(csvStringFile.getPath(), headerPresent); assertEquals(dataList.size(), actualDataList.size()); for (int i = 0; i < actualDataList.size(); i++) { assertArrayEquals("Row " + i + " does not match", dataList.get(i), actualDataList.get(i)); } }
@Test public void testGetCsvDataArray_fromReader() throws IOException { Reader reader = Files.newReader(csvStringFile, StandardCharsets.UTF_8); List<String[]> actualDataArray = CsvFiles.getCsvDataArray(reader, headerPresent); assertEquals(dataList.size(), actualDataArray.size()); for (int i = 0; i < actualDataArray.size(); i++) { assertArrayEquals("Row " + i + " does not match", dataList.get(i), actualDataArray.get(i)); } thrown.expect(IOException.class); thrown.expectMessage("Stream closed"); reader.ready(); }