@Test public void detect_A$String_CRLF() throws Exception { String sourceCodeString = "foo\r\nbar\r\n"; CurrentLineBreak actual = CurrentLineBreakDetector.detect(sourceCodeString); CurrentLineBreak expected = CurrentLineBreak.CRLF; assertThat(actual, is(equalTo(expected))); }
public static CurrentLineBreak detect(String sourceCodeString) { if (sourceCodeString == null) { return null; } else if (sourceCodeString.contains("\r\n")) { return CurrentLineBreak.CRLF; } else if (sourceCodeString.contains("\n")) { return CurrentLineBreak.LF; } return null; }
CurrentLineBreakDetector { public static CurrentLineBreak detect(String sourceCodeString) { if (sourceCodeString == null) { return null; } else if (sourceCodeString.contains("\r\n")) { return CurrentLineBreak.CRLF; } else if (sourceCodeString.contains("\n")) { return CurrentLineBreak.LF; } return null; } }
CurrentLineBreakDetector { public static CurrentLineBreak detect(String sourceCodeString) { if (sourceCodeString == null) { return null; } else if (sourceCodeString.contains("\r\n")) { return CurrentLineBreak.CRLF; } else if (sourceCodeString.contains("\n")) { return CurrentLineBreak.LF; } return null; } private  CurrentLineBreakDetector(); }
CurrentLineBreakDetector { public static CurrentLineBreak detect(String sourceCodeString) { if (sourceCodeString == null) { return null; } else if (sourceCodeString.contains("\r\n")) { return CurrentLineBreak.CRLF; } else if (sourceCodeString.contains("\n")) { return CurrentLineBreak.LF; } return null; } private  CurrentLineBreakDetector(); static CurrentLineBreak detect(String sourceCodeString); }
CurrentLineBreakDetector { public static CurrentLineBreak detect(String sourceCodeString) { if (sourceCodeString == null) { return null; } else if (sourceCodeString.contains("\r\n")) { return CurrentLineBreak.CRLF; } else if (sourceCodeString.contains("\n")) { return CurrentLineBreak.LF; } return null; } private  CurrentLineBreakDetector(); static CurrentLineBreak detect(String sourceCodeString);  }