Buggy code:
public class UriUtilsTest { private static final String ENC = "UTF-8" ; @ Test public void encodeScheme ( ) throws UnsupportedEncodingException { } @ Test public void encodeUserInfo ( ) throws UnsupportedEncodingException { } @ Test public void encodeHost ( ) throws UnsupportedEncodingException { } @ Test public void encodePort ( ) throws UnsupportedEncodingException { } @ Test public void encodePath ( ) throws UnsupportedEncodingException { } @ Test public void encodePathSegment ( ) throws UnsupportedEncodingException { } @ Test public void encodeQuery ( ) throws UnsupportedEncodingException { } @ Test public void encodeQueryParam ( ) throws UnsupportedEncodingException { } @ Test public void encodeFragment ( ) throws UnsupportedEncodingException { } @ Test public void decode ( ) throws UnsupportedEncodingException { } @ Test ( expected = IllegalArgumentException . class ) public void decodeInvalidSequence ( ) throws UnsupportedEncodingException { } @ Test public void encodeUri ( ) throws UnsupportedEncodingException { assertEquals ( "Invalid<seq2seq4repair_space>encoded<seq2seq4repair_space>URI" , "http:////www.ietf.org//rfc//rfc3986.txt" , UriUtils . encodeUri ( "http:////www.ietf.org//rfc//rfc3986.txt" , UriUtilsTest . ENC ) ) ; <START_BUG> assertEquals ( "Invalid<seq2seq4repair_space>encoded<seq2seq4repair_space>URI" , "http:////www.google.com//?q=z%FCrich" , UriUtils . encodeUri ( "http:////www.google.com//?q=zrich" , UriUtilsTest . ENC ) ) ; <END_BUG> assertEquals ( "Invalid<seq2seq4repair_space>encoded<seq2seq4repair_space>URI" , "http:////arjen:foobar@java.sun.com:80//javase//6//docs//api//java//util//BitSet.html?foo=bar#and(java.util.BitSet)" , UriUtils . encodeUri ( "http:////arjen:foobar@java.sun.com:80//javase//6//docs//api//java//util//BitSet.html?foo=bar#and(java.util.BitSet)" , UriUtilsTest . ENC ) ) ; assertEquals ( "Invalid<seq2seq4repair_space>encoded<seq2seq4repair_space>URI" , "mailto:java-net@java.sun.com" , UriUtils . encodeUri ( "mailto:java-net@java.sun.com" , UriUtilsTest . ENC ) ) ; assertEquals ( "Invalid<seq2seq4repair_space>encoded<seq2seq4repair_space>URI" , "news:comp.lang.java" , UriUtils . encodeUri ( "news:comp.lang.java" , UriUtilsTest . ENC ) ) ; assertEquals ( "Invalid<seq2seq4repair_space>encoded<seq2seq4repair_space>URI" , "urn:isbn:096139210x" , UriUtils . encodeUri ( "urn:isbn:096139210x" , UriUtilsTest . ENC ) ) ; assertEquals ( "Invalid<seq2seq4repair_space>encoded<seq2seq4repair_space>URI" , "http:////java.sun.com//j2se//1.3//" , UriUtils . encodeUri ( "http:////java.sun.com//j2se//1.3//" , UriUtilsTest . ENC ) ) ; assertEquals ( "Invalid<seq2seq4repair_space>encoded<seq2seq4repair_space>URI" , "docs//guide//collections//designfaq.html#28" , UriUtils . encodeUri ( "docs//guide//collections//designfaq.html#28" , UriUtilsTest . ENC ) ) ; assertEquals ( "Invalid<seq2seq4repair_space>encoded<seq2seq4repair_space>URI" , "..//..//..//demo//jfc//SwingSet2//src//SwingSet2.java" , UriUtils . encodeUri ( "..//..//..//demo//jfc//SwingSet2//src//SwingSet2.java" , UriUtilsTest . ENC ) ) ; assertEquals ( "Invalid<seq2seq4repair_space>encoded<seq2seq4repair_space>URI" , "file://////~//calendar" , UriUtils . encodeUri ( "file://////~//calendar" , UriUtilsTest . ENC ) ) ; } }

Fix:
assertEquals ( "Invalid<seq2seq4repair_space>encoded<seq2seq4repair_space>URI" , "http:////www.google.com//?q=z%FCrich" , UriUtils . encodeUri ( "http:////www.google.com//?q=zürich" , UriUtilsTest . ENC ) ) ;