### Question:
UrlUtils { public static String appendParams(String url, Map<?, ?> params) throws UnsupportedEncodingException { return appendParams(url, params, "UTF-8"); } private  UrlUtils(); static boolean isUrlOK(String str); static String appendParams(String url, Map<?, ?> params); static StringBuilder appendParams(StringBuilder url, Map<?, ?> params, String charset); static String appendParams(String url, Map<?, ?> params, String charset); static String encodePath(String fileName, boolean withRoot);  }### Answer:
@Test(dataProvider = "appendParams") public void testAppendParams(String url, Map<Object, Object> params, String expected) throws Exception { String str = UrlUtils.appendParams(url, params, "UTF-8"); System.out.println("url:" + url + ", params:" + String.valueOf(params) + " = result:" + str); Assert.assertEquals(str, expected); }
@Test(dataProvider = "appendParamsWithException", expectedExceptions = { UnsupportedEncodingException.class }) public void testAppendParamsWithException(String url, Map<Object, Object> params) throws Exception { UrlUtils.appendParams("/test/testAction", params, "UF-8"); }