@Test public void testBuildUrl() throws Exception { String expectedString = "http: String actualString = UrlUtils.buildUrl("http: Assert.assertEquals(expectedString, actualString); actualString = UrlUtils.buildUrl("http: Assert.assertEquals(expectedString, actualString); actualString = UrlUtils.buildUrl("http: Assert.assertEquals(expectedString, actualString); actualString = UrlUtils.buildUrl("http: Assert.assertEquals(expectedString, actualString); }
public static String buildUrl(final String finalBaseUri, final String finalEndpoint) { StringBuffer url = new StringBuffer(); if (finalBaseUri != null) { String baseUri = finalBaseUri.trim(); if (baseUri.endsWith("/")) { url.append(baseUri.substring(0, baseUri.length() - 1)); } else { url.append(baseUri); } if (finalEndpoint != null) { String endpoint = finalEndpoint.trim(); if (endpoint.length() > 0 ) { url.append("/"); if (endpoint.startsWith("/")) { url.append(endpoint.substring(1, endpoint.length())); } else { url.append(endpoint); } } } return url.toString(); } return null; }
UrlUtils { public static String buildUrl(final String finalBaseUri, final String finalEndpoint) { StringBuffer url = new StringBuffer(); if (finalBaseUri != null) { String baseUri = finalBaseUri.trim(); if (baseUri.endsWith("/")) { url.append(baseUri.substring(0, baseUri.length() - 1)); } else { url.append(baseUri); } if (finalEndpoint != null) { String endpoint = finalEndpoint.trim(); if (endpoint.length() > 0 ) { url.append("/"); if (endpoint.startsWith("/")) { url.append(endpoint.substring(1, endpoint.length())); } else { url.append(endpoint); } } } return url.toString(); } return null; } }
UrlUtils { public static String buildUrl(final String finalBaseUri, final String finalEndpoint) { StringBuffer url = new StringBuffer(); if (finalBaseUri != null) { String baseUri = finalBaseUri.trim(); if (baseUri.endsWith("/")) { url.append(baseUri.substring(0, baseUri.length() - 1)); } else { url.append(baseUri); } if (finalEndpoint != null) { String endpoint = finalEndpoint.trim(); if (endpoint.length() > 0 ) { url.append("/"); if (endpoint.startsWith("/")) { url.append(endpoint.substring(1, endpoint.length())); } else { url.append(endpoint); } } } return url.toString(); } return null; }  }
UrlUtils { public static String buildUrl(final String finalBaseUri, final String finalEndpoint) { StringBuffer url = new StringBuffer(); if (finalBaseUri != null) { String baseUri = finalBaseUri.trim(); if (baseUri.endsWith("/")) { url.append(baseUri.substring(0, baseUri.length() - 1)); } else { url.append(baseUri); } if (finalEndpoint != null) { String endpoint = finalEndpoint.trim(); if (endpoint.length() > 0 ) { url.append("/"); if (endpoint.startsWith("/")) { url.append(endpoint.substring(1, endpoint.length())); } else { url.append(endpoint); } } } return url.toString(); } return null; }  static String buildUrl(final String finalBaseUri, final String finalEndpoint); }
UrlUtils { public static String buildUrl(final String finalBaseUri, final String finalEndpoint) { StringBuffer url = new StringBuffer(); if (finalBaseUri != null) { String baseUri = finalBaseUri.trim(); if (baseUri.endsWith("/")) { url.append(baseUri.substring(0, baseUri.length() - 1)); } else { url.append(baseUri); } if (finalEndpoint != null) { String endpoint = finalEndpoint.trim(); if (endpoint.length() > 0 ) { url.append("/"); if (endpoint.startsWith("/")) { url.append(endpoint.substring(1, endpoint.length())); } else { url.append(endpoint); } } } return url.toString(); } return null; }  static String buildUrl(final String finalBaseUri, final String finalEndpoint);  }