EolHelper { public static String getStartEol(String line) { if (line == null) { throw new IllegalArgumentException("Line argument cannot be null"); } if (line.startsWith("\n")) return "\n"; if (line.startsWith("\r\n")) return "\r\n"; if (line.startsWith("\r")) return "\r"; return null; }  @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 getStartEolTest() { Assert.assertEquals(EolHelper.getStartEol(LINE1), null); Assert.assertEquals(EolHelper.getStartEol(LINE2), "\r\n"); Assert.assertEquals(EolHelper.getStartEol(LINE3), null); }