### Question:
TextUtil { public static String normalizePostData( final String postData ) { final StringBuilder sb = new StringBuilder(); for( int i = 0; i < postData.length(); i++ ) { switch( postData.charAt(i) ) { case 0x0a: sb.append( "\r\n" ); break; case 0x0d: sb.append( "\r\n" ); if( i < postData.length() - 1 && postData.charAt( i + 1 ) == 0x0a ) { i++; } break; default: sb.append( postData.charAt( i ) ); break; } } if( sb.length() < 2 || !sb.substring( sb.length()-2 ).equals( "\r\n" ) ) { sb.append( "\r\n" ); } return sb.toString(); } private  TextUtil(); static String urlEncodeUTF8( final String text ); static String urlDecodeUTF8( final String utf8 ); static String urlEncode( final String data, final String encoding ); static String urlDecode( final String data, final String encoding ); static String replaceEntities( String src ); static String replaceString( final String orig, final String src, final String dest ); static String replaceString( final String orig, final int start, final int end, final String text ); static String replaceStringCaseUnsensitive( final String orig, final String src, final String dest ); static int parseIntParameter( final String value, final int defvalue ); static int getIntegerProperty( final Properties props, final String key, final int defVal ); static boolean getBooleanProperty( final Properties props, final String key, final boolean defval ); static String getStringProperty( final Properties props, final String key, final String defval ); static String getRequiredProperty( final Properties props, final String key ); static String getCanonicalFilePathProperty( final Properties props, final String key, final String defval ); static boolean isPositive( String val ); static String normalizePostData( final String postData ); static String beautifyString( final String s ); static String beautifyString( final String s, final String space ); static String cleanString( String text, final String allowedChars ); static Properties createProperties( final String[] values ); static int countSections( final String pagedata ); static String getSection( final String pagedata, final int section ); static String repeatString( final String what, final int times ); static String native2Ascii( final String s ); static String toHexString( final byte[] bytes ); static boolean isNumber( String s ); static String generateRandomPassword(); static final int PASSWORD_LENGTH; static final String LEGACY_CHARS_ALLOWED; static final String PUNCTUATION_CHARS_ALLOWED; }### Answer:
@Test public void testNormalizePostdata1() { final String text = "ab\ncd"; Assertions.assertEquals( "ab\r\ncd\r\n", TextUtil.normalizePostData( text ) ); }
@Test public void testNormalizePostdata2() { final String text = "ab\r\ncd"; Assertions.assertEquals( "ab\r\ncd\r\n", TextUtil.normalizePostData( text ) ); }
@Test public void testNormalizePostdata3() { final String text = "ab\rcd"; Assertions.assertEquals( "ab\r\ncd\r\n", TextUtil.normalizePostData( text ) ); }
@Test public void testNormalizePostdata4() { final String text = "ab\ncd\r\n\r\n\r"; Assertions.assertEquals( "ab\r\ncd\r\n\r\n\r\n", TextUtil.normalizePostData( text ) ); }
@Test public void testNormalizePostdata5() { final String text = "ab\ncd\n\n\n\n"; Assertions.assertEquals( "ab\r\ncd\r\n\r\n\r\n\r\n", TextUtil.normalizePostData( text ) ); }
@Test public void testNormalizePostdata6() { final String text = ""; Assertions.assertEquals( "\r\n", TextUtil.normalizePostData( text ) ); }
@Test public void testNormalizePostdata7() { final String text = "\n"; Assertions.assertEquals( "\r\n", TextUtil.normalizePostData( text ) ); }