LibUtils { public static String urlEncode(String string) { if (string == null) { return null; } try { return URLEncoder.encode(string, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }  static URL buildUrl(String urlPrefix, String urlSuffix); static URL generateDirectIpaUrl(String referer, String ipaClassifier, String otaClassifier); static String replaceLast(String string, String searchString, String replaceString); static String urlEncode(String string); static String urlDecode(String string); static String encode(String string); static String decode(String string); static Map<String, String> buildMap(String... keyValuePairs);  }
@Test public void testUrlEncode() throws UnsupportedEncodingException { assertNull(LibUtils.urlEncode(null)); assertEquals("", LibUtils.urlEncode("")); assertEquals("http%3A%2F%2Fwdfd00254211a.dhcp.wdf.sap.corp%3A8080%2Fota-webapp%2FPLIST", LibUtils.urlEncode( "http: assertEquals("MyAppName", LibUtils.urlEncode( "MyAppName")); assertEquals("com.sap.xyz.MyApp", LibUtils.urlEncode( "com.sap.xyz.MyApp")); assertEquals("1.0.4", LibUtils.urlEncode( "1.0.4")); assertEquals("Referer%3Dhttp%3A%2F%2Fwdfd00254211a.dhcp.wdf.sap.corp%3A8080%2Fota-webapp%2FPLIST", LibUtils.urlEncode( "Referer=http: assertEquals("title%3DMyAppName", LibUtils.urlEncode( "title=MyAppName")); assertEquals("bundleIdentifier%3Dcom.sap.xyz.MyApp", LibUtils.urlEncode( "bundleIdentifier=com.sap.xyz.MyApp")); assertEquals("bundleVersion%3D1.0.4", LibUtils.urlEncode( "bundleVersion=1.0.4")); }