EolHelper { @SuppressFBWarnings("DM_DEFAULT_ENCODING") public static String findEol(File textFile) throws IOException { if (textFile == null) { throw new IllegalArgumentException("Text file object cannot be null"); } if (!textFile.isFile()) { throw new IllegalArgumentException("Text file is not a file"); } if (textFile.length() == 0) { return null; } EolBufferedReader eolBufferedReader = null; try { eolBufferedReader = new EolBufferedReader(new BufferedReader(new FileReader(textFile))); String line = eolBufferedReader.readLineKeepEol(); return getEndEol(line); } finally { if (eolBufferedReader != null) eolBufferedReader.close(); } }  @SuppressFBWarnings("DM_DEFAULT_ENCODING") static String findEol(File textFile); static String findEolDefaultToOs(File textFile); static String removeEol(String line); static boolean startsWithEol(String line); static boolean endsWithEol(String line); static String getStartEol(String line); static String getEndEol(String line);  }
@Test public void findEolTest() throws IOException, URISyntaxException { File file = new File(EolHelperTest.class.getResource("/billy.yaml").toURI()); Assert.assertEquals(EolHelper.findEol(file), "\n"); }
@Test public void findEolForEmptyFileTest() throws IOException, URISyntaxException { File file = new File(EolHelperTest.class.getResource("/test-app/src/main/resources/application-empty.properties").toURI()); Assert.assertEquals(EolHelper.findEol(file), null); }