### Question:
LineEndingsUtils { @Nullable public static String getLineEndingCharacters( @Nullable String lineEnding ) throws AssemblyFormattingException { String value = lineEnding; if ( lineEnding != null ) { try { value = LineEndings.valueOf( lineEnding ).getLineEndingCharacters(); } catch ( IllegalArgumentException e ) { throw new AssemblyFormattingException( "Illegal lineEnding specified: '" + lineEnding + "'", e ); } } return value; } private  LineEndingsUtils(); static void convertLineEndings( @Nonnull File source, @Nonnull File dest, LineEndings lineEndings,
                                           Boolean atEndOfFile, String encoding ); @SuppressWarnings( "resource" ) static InputStream lineEndingConverter( @Nonnull InputStream in, LineEndings lineEndings ); @Nonnull static LineEndings getLineEnding( @Nullable String lineEnding ); @Nullable static String getLineEndingCharacters( @Nullable String lineEnding );  }### Answer:
@Test public void shouldWorkCauseWeTestJdkEnumConversion() { LineEndings lineEnding = LineEndings.valueOf( "windows" ); assertEquals( CRLF, lineEnding.getLineEndingCharacters() ); }
@Test public void shouldReturnDosLineEnding() { assertEquals( CRLF, LineEndings.windows.getLineEndingCharacters() ); assertEquals( CRLF, LineEndings.dos.getLineEndingCharacters() ); assertEquals( CRLF, LineEndings.crlf.getLineEndingCharacters() ); }
@Test public void shouldReturnUnixLineEnding() { assertEquals( LF, LineEndings.unix.getLineEndingCharacters() ); assertEquals( LF, LineEndings.lf.getLineEndingCharacters() ); }
@Test public void shouldReturnNullAsLineEndingForKeep() { assertEquals( null, LineEndings.keep.getLineEndingCharacters() ); }
@Test public void testGetLineEndingChars_ShouldReturnDosLineEnding() throws AssemblyFormattingException { assertEquals( "\r\n", LineEndingsUtils.getLineEndingCharacters( "windows" ) ); assertEquals( "\r\n", LineEndingsUtils.getLineEndingCharacters( "dos" ) ); assertEquals( "\r\n", LineEndingsUtils.getLineEndingCharacters( "crlf" ) ); }
@Test public void testGetLineEndingChars_ShouldReturnUnixLineEnding() throws AssemblyFormattingException { assertEquals( "\n", LineEndingsUtils.getLineEndingCharacters( "unix" ) ); assertEquals( "\n", LineEndingsUtils.getLineEndingCharacters( "lf" ) ); }
@Test public void testGetLineEndingChars_ShouldReturnNullLineEnding() throws AssemblyFormattingException { assertNull( LineEndingsUtils.getLineEndingCharacters( "keep" ) ); }
@Test( expected = AssemblyFormattingException.class ) public void testGetLineEndingChars_ShouldThrowFormattingExceptionWithInvalidHint() throws AssemblyFormattingException { LineEndingsUtils.getLineEndingCharacters( "invalid" ); }