@Test public void readFile() { String output = fileReader.readFile(file); int expectedLines = 47; String[] lines = output.split(System.getProperty("line.separator")); assertEquals(expectedLines, lines.length); }
public String readFile(File selectedFile) { String fileContents = ""; try (BufferedReader br = new BufferedReader(new java.io.FileReader(selectedFile))) { String line; while ((line = br.readLine()) != null) { fileContents = fileContents.concat(line + '\n'); } } catch (IOException e) { Logger.getAnonymousLogger().log(Level.SEVERE, "Exception", e); ErrorDialogGenerator.generateErrorListBox(e.getMessage(), "File Read Error", "There was an error reading the input file"); Platform.exit(); } return fileContents; }
FileReader { public String readFile(File selectedFile) { String fileContents = ""; try (BufferedReader br = new BufferedReader(new java.io.FileReader(selectedFile))) { String line; while ((line = br.readLine()) != null) { fileContents = fileContents.concat(line + '\n'); } } catch (IOException e) { Logger.getAnonymousLogger().log(Level.SEVERE, "Exception", e); ErrorDialogGenerator.generateErrorListBox(e.getMessage(), "File Read Error", "There was an error reading the input file"); Platform.exit(); } return fileContents; } }
FileReader { public String readFile(File selectedFile) { String fileContents = ""; try (BufferedReader br = new BufferedReader(new java.io.FileReader(selectedFile))) { String line; while ((line = br.readLine()) != null) { fileContents = fileContents.concat(line + '\n'); } } catch (IOException e) { Logger.getAnonymousLogger().log(Level.SEVERE, "Exception", e); ErrorDialogGenerator.generateErrorListBox(e.getMessage(), "File Read Error", "There was an error reading the input file"); Platform.exit(); } return fileContents; }  }
FileReader { public String readFile(File selectedFile) { String fileContents = ""; try (BufferedReader br = new BufferedReader(new java.io.FileReader(selectedFile))) { String line; while ((line = br.readLine()) != null) { fileContents = fileContents.concat(line + '\n'); } } catch (IOException e) { Logger.getAnonymousLogger().log(Level.SEVERE, "Exception", e); ErrorDialogGenerator.generateErrorListBox(e.getMessage(), "File Read Error", "There was an error reading the input file"); Platform.exit(); } return fileContents; }  String readFile(File selectedFile); }
FileReader { public String readFile(File selectedFile) { String fileContents = ""; try (BufferedReader br = new BufferedReader(new java.io.FileReader(selectedFile))) { String line; while ((line = br.readLine()) != null) { fileContents = fileContents.concat(line + '\n'); } } catch (IOException e) { Logger.getAnonymousLogger().log(Level.SEVERE, "Exception", e); ErrorDialogGenerator.generateErrorListBox(e.getMessage(), "File Read Error", "There was an error reading the input file"); Platform.exit(); } return fileContents; }  String readFile(File selectedFile);  }