package com.tguzik.tests;

import javax.annotation.Nullable;

import org.apache.commons.lang3.StringUtils;

/**
 * Unit test utility that normalizes Windows (\r\n) and legacy OSX (\r) line
 * endings into unix-style (\n). This is placed in main sources (as opposed to
 * unit test sources) to allow using this class in projects that depend on this
 * library.
 *
 * @author Tomasz Guzik <tomek@tguzik.com>
 * @since 0.1
 */
public enum Normalize {
    ;

    /**
     * Replaces different line ending styles (Windows <code>\r\n</code>, legacy
     * Mac <code>\r</code>) with single new line character (<code>\n</code>).
     * <p/>
     * Example usage:
     * <pre>
     * assertEquals( expected, Normalize.newLines( actual ) );
     * </pre>
     *
     * @param input
     *         nullable input string
     *
     * @return new string with all newline sequences replaced with LF ending
     */
    @Nullable
    public static String newLines( @Nullable String input ) {
        return input == null ? null : input.replaceAll( "(\r)?\n(\r)?", "\n" ).replaceAll( "\r", "\n" );
    }

    /**
     * Replaces all tabulation (<code>\t</code>) characters with spaces.
     *
     * @param input
     *         nullable input string
     * @param tabWidth
     *         width in spaces of each tabulation character
     *
     * @return If input was not null, returns new string with all tabulation characters replaces by spaces. If input
     * was null, returns null.
     */
    @Nullable
    public static String tabsToSpaces( @Nullable String input, int tabWidth ) {
        int spacesInSingleTab = (tabWidth < 0) ? 0 : tabWidth;
        String replacement = StringUtils.repeat( ' ', spacesInSingleTab );
        return input == null ? null : input.replaceAll( "\t", replacement );
    }
}

@@ -970,38 +970,36 @@
 put ) %7B%0A        
-return
+if (
  input == null ?
@@ -993,32 +993,78 @@
 put == null 
-? null :
+) %7B%0A            return null;%0A        %7D%0A%0A        return
  input.repla
@@ -1619,16 +1619,89 @@
         
+if ( input == null ) %7B%0A            return null;%0A        %7D%0A%0A        final 
 int spac
@@ -1755,16 +1755,22 @@
         
+final 
 String r
@@ -1846,31 +1846,8 @@
 turn
- input == null ? null :
  inp

Make it more readable.