URIUtil { public static StringBuffer encodePath(StringBuffer buf, String path) { if (buf == null) { loop: for (int i = 0; i < path.length(); i++) { char c = path.charAt(i); switch (c) { case '%': case '?': case ';': case '#': case ' ': buf = new StringBuffer(path.length() << 1); break loop; } } if (buf == null) return null; } synchronized (buf) { for (int i = 0; i < path.length(); i++) { char c = path.charAt(i); switch (c) { case '%': buf.append("%25"); continue; case '?': buf.append("%3F"); continue; case ';': buf.append("%3B"); continue; case '#': buf.append("%23"); continue; case ' ': buf.append("%20"); continue; default: buf.append(c); continue; } } } return buf; }  static StringBuffer encodePath(StringBuffer buf, String path);  }
@Test public void testEncodePath_1() throws Exception { StringBuffer buf = null; String path = ""; StringBuffer result = URIUtil.encodePath(buf, path); assertEquals(null, result); }
@Test public void testEncodePath_2() throws Exception { StringBuffer buf = null; String path = "aa"; StringBuffer result = URIUtil.encodePath(buf, path); assertEquals(null, result); }
@Test public void testEncodePath_3() throws Exception { StringBuffer buf = null; String path = "aa"; StringBuffer result = URIUtil.encodePath(buf, path); assertEquals(null, result); }
@Test public void testEncodePath_4() throws Exception { StringBuffer buf = null; String path = "aa"; StringBuffer result = URIUtil.encodePath(buf, path); assertEquals(null, result); }
@Test public void testEncodePath_5() throws Exception { StringBuffer buf = null; String path = "aa"; StringBuffer result = URIUtil.encodePath(buf, path); assertEquals(null, result); }
@Test public void testEncodePath_6() throws Exception { StringBuffer buf = null; String path = "aa"; StringBuffer result = URIUtil.encodePath(buf, path); assertEquals(null, result); }
@Test public void testEncodePath_7() throws Exception { StringBuffer buf = new StringBuffer(); String path = ""; StringBuffer result = URIUtil.encodePath(buf, path); assertNotNull(result); assertEquals("", result.toString()); assertEquals(0, result.length()); assertEquals(16, result.capacity()); }