@Test public void testLoadFileWithEmptyFile() throws IOException { given(fileInfo.getConfigFilename()).willReturn("src/test/resources/TestClass.txt"); DataDrivenParameterArray actual = underTest.loadFile(fileInfo, 0); Assert.assertNotNull(actual); }
public DataDrivenParameterArray loadFile(final ConfigFileInfo fileInfo, final int multiplier) throws IOException { DataDrivenParameterArray myArray = new DataDrivenParameterArray(); LineNumberReader listReader = new LineNumberReader(new InputStreamReader(new FileInputStream(fileInfo.getConfigFilename()), "UTF-8")); String headerLine = null; String line; Integer counter = 0; String[] rowData; String[] columnNames = null; while ((line = listReader.readLine()) != null) { line = line.trim(); if (("".equals(line) || line.startsWith(" continue; } if (fileInfo.isCSV() && (headerLine == null)) { headerLine = line; columnNames = headerLine.split(fileInfo.getSplitter()); } else { rowData = line.split(fileInfo.getSplitter()); myArray.put(counter, rowData); counter++; } if (counter == multiplier) { break; } } listReader.close(); if (columnNames != null) { myArray.setParameterNames(columnNames); } else { myArray.setParameterNames(DataDrivenParameterArray.generateNames(myArray)); } return myArray; }
SimpleMultiplierDataFeederFileLoader { public DataDrivenParameterArray loadFile(final ConfigFileInfo fileInfo, final int multiplier) throws IOException { DataDrivenParameterArray myArray = new DataDrivenParameterArray(); LineNumberReader listReader = new LineNumberReader(new InputStreamReader(new FileInputStream(fileInfo.getConfigFilename()), "UTF-8")); String headerLine = null; String line; Integer counter = 0; String[] rowData; String[] columnNames = null; while ((line = listReader.readLine()) != null) { line = line.trim(); if (("".equals(line) || line.startsWith(" continue; } if (fileInfo.isCSV() && (headerLine == null)) { headerLine = line; columnNames = headerLine.split(fileInfo.getSplitter()); } else { rowData = line.split(fileInfo.getSplitter()); myArray.put(counter, rowData); counter++; } if (counter == multiplier) { break; } } listReader.close(); if (columnNames != null) { myArray.setParameterNames(columnNames); } else { myArray.setParameterNames(DataDrivenParameterArray.generateNames(myArray)); } return myArray; } }
SimpleMultiplierDataFeederFileLoader { public DataDrivenParameterArray loadFile(final ConfigFileInfo fileInfo, final int multiplier) throws IOException { DataDrivenParameterArray myArray = new DataDrivenParameterArray(); LineNumberReader listReader = new LineNumberReader(new InputStreamReader(new FileInputStream(fileInfo.getConfigFilename()), "UTF-8")); String headerLine = null; String line; Integer counter = 0; String[] rowData; String[] columnNames = null; while ((line = listReader.readLine()) != null) { line = line.trim(); if (("".equals(line) || line.startsWith(" continue; } if (fileInfo.isCSV() && (headerLine == null)) { headerLine = line; columnNames = headerLine.split(fileInfo.getSplitter()); } else { rowData = line.split(fileInfo.getSplitter()); myArray.put(counter, rowData); counter++; } if (counter == multiplier) { break; } } listReader.close(); if (columnNames != null) { myArray.setParameterNames(columnNames); } else { myArray.setParameterNames(DataDrivenParameterArray.generateNames(myArray)); } return myArray; }  }
SimpleMultiplierDataFeederFileLoader { public DataDrivenParameterArray loadFile(final ConfigFileInfo fileInfo, final int multiplier) throws IOException { DataDrivenParameterArray myArray = new DataDrivenParameterArray(); LineNumberReader listReader = new LineNumberReader(new InputStreamReader(new FileInputStream(fileInfo.getConfigFilename()), "UTF-8")); String headerLine = null; String line; Integer counter = 0; String[] rowData; String[] columnNames = null; while ((line = listReader.readLine()) != null) { line = line.trim(); if (("".equals(line) || line.startsWith(" continue; } if (fileInfo.isCSV() && (headerLine == null)) { headerLine = line; columnNames = headerLine.split(fileInfo.getSplitter()); } else { rowData = line.split(fileInfo.getSplitter()); myArray.put(counter, rowData); counter++; } if (counter == multiplier) { break; } } listReader.close(); if (columnNames != null) { myArray.setParameterNames(columnNames); } else { myArray.setParameterNames(DataDrivenParameterArray.generateNames(myArray)); } return myArray; }  DataDrivenParameterArray loadFile(final ConfigFileInfo fileInfo, final int multiplier); }
SimpleMultiplierDataFeederFileLoader { public DataDrivenParameterArray loadFile(final ConfigFileInfo fileInfo, final int multiplier) throws IOException { DataDrivenParameterArray myArray = new DataDrivenParameterArray(); LineNumberReader listReader = new LineNumberReader(new InputStreamReader(new FileInputStream(fileInfo.getConfigFilename()), "UTF-8")); String headerLine = null; String line; Integer counter = 0; String[] rowData; String[] columnNames = null; while ((line = listReader.readLine()) != null) { line = line.trim(); if (("".equals(line) || line.startsWith(" continue; } if (fileInfo.isCSV() && (headerLine == null)) { headerLine = line; columnNames = headerLine.split(fileInfo.getSplitter()); } else { rowData = line.split(fileInfo.getSplitter()); myArray.put(counter, rowData); counter++; } if (counter == multiplier) { break; } } listReader.close(); if (columnNames != null) { myArray.setParameterNames(columnNames); } else { myArray.setParameterNames(DataDrivenParameterArray.generateNames(myArray)); } return myArray; }  DataDrivenParameterArray loadFile(final ConfigFileInfo fileInfo, final int multiplier);  }