@Test public void testAssertCurrentLineSeparatorIsAllowed() { SourceFormatterUtil .staticSetCurrentLineSeparatorForTesting(EOL_WINDOWS_STYLE_CRLF); SourceFormatterUtil.assertCurrentLineSeparatorIsAllowed(); SourceFormatterUtil .staticSetCurrentLineSeparatorForTesting(EOL_UNIX_STYLE_LF); SourceFormatterUtil.assertCurrentLineSeparatorIsAllowed(); try { SourceFormatterUtil .staticSetCurrentLineSeparatorForTesting("UNKNOWN_EOL"); SourceFormatterUtil.assertCurrentLineSeparatorIsAllowed(); Assert.fail("expected exception"); } catch (IllegalStateException e) { Assert.assertTrue(e.getMessage().contains("unknown")); } }
static void assertCurrentLineSeparatorIsAllowed() { if (!EOL_WINDOWS_STYLE_CRLF.equals(currentLineSeparator) && !EOL_UNIX_STYLE_LF.equals(currentLineSeparator)) { throw new IllegalStateException( "current line separator is unknown: before_" + currentLineSeparator + "_after"); } }
SourceFormatterUtil { static void assertCurrentLineSeparatorIsAllowed() { if (!EOL_WINDOWS_STYLE_CRLF.equals(currentLineSeparator) && !EOL_UNIX_STYLE_LF.equals(currentLineSeparator)) { throw new IllegalStateException( "current line separator is unknown: before_" + currentLineSeparator + "_after"); } } }
SourceFormatterUtil { static void assertCurrentLineSeparatorIsAllowed() { if (!EOL_WINDOWS_STYLE_CRLF.equals(currentLineSeparator) && !EOL_UNIX_STYLE_LF.equals(currentLineSeparator)) { throw new IllegalStateException( "current line separator is unknown: before_" + currentLineSeparator + "_after"); } } private  SourceFormatterUtil(); }
SourceFormatterUtil { static void assertCurrentLineSeparatorIsAllowed() { if (!EOL_WINDOWS_STYLE_CRLF.equals(currentLineSeparator) && !EOL_UNIX_STYLE_LF.equals(currentLineSeparator)) { throw new IllegalStateException( "current line separator is unknown: before_" + currentLineSeparator + "_after"); } } private  SourceFormatterUtil(); static String formatSource(String source); }
SourceFormatterUtil { static void assertCurrentLineSeparatorIsAllowed() { if (!EOL_WINDOWS_STYLE_CRLF.equals(currentLineSeparator) && !EOL_UNIX_STYLE_LF.equals(currentLineSeparator)) { throw new IllegalStateException( "current line separator is unknown: before_" + currentLineSeparator + "_after"); } } private  SourceFormatterUtil(); static String formatSource(String source);  }