TankHttpUtil { public static URL buildUrl(String protocol, String host, int port, String path, Map<String, String> urlVariables) { try { if (port == 80 || port == 8080) { protocol = "http"; } return (port == -1) ? new URL(protocol, host, path + getQueryString(urlVariables)) : new URL(protocol, host, port, path + getQueryString(urlVariables)); } catch (MalformedURLException e) { throw new RuntimeException(e); } }  static URL buildUrl(String protocol, String host, int port, String path, Map<String, String> urlVariables); static String getQueryString(Map<String, String> urlVariables); static BaseResponse newResponseObject(String contentTypeHeader); static List<PartHolder> getPartsFromBody(BaseRequest request);  }
@Test public void testBuildUrl_1() throws Exception { String protocol = ""; String host = ""; int port = 8080; String path = ""; Map<String, String> urlVariables = new HashMap(); URL result = TankHttpUtil.buildUrl(protocol, host, port, path, urlVariables); assertNotNull(result); }
@Test public void testBuildUrl_2() throws Exception { String protocol = "http"; String host = "www.testdomain.com"; int port = 80; String path = "/index.html"; Map<String, String> urlVariables = new HashMap(); URL result = TankHttpUtil.buildUrl(protocol, host, port, path, urlVariables); assertNotNull(result); }
@Test public void testBuildUrl_3() throws Exception { String protocol = "https"; String host = "www.testdomain.com"; int port = 443; String path = "/index.html"; Map<String, String> urlVariables = new HashMap(); URL result = TankHttpUtil.buildUrl(protocol, host, port, path, urlVariables); assertNotNull(result); }
@Test public void testBuildUrl_4() throws Exception { String protocol = "http"; String host = "www.testdomain.com"; int port = 8080; String path = "/index.html"; Map<String, String> urlVariables = new HashMap(); URL result = TankHttpUtil.buildUrl(protocol, host, port, path, urlVariables); assertNotNull(result); }