### Question:
UrlUtils { public static String toBaseUrl(final String uriString) { try { final URL url = new URL(uriString); return url.getProtocol() + ": } catch (final MalformedURLException e) { e.printStackTrace(); } return null; }  static boolean isHttpUrl(final String url); static boolean isHttpsUrl(final String url); static String toBaseUrl(final String uriString); static String sanitizePath(final String path); static String combine(final String... parts);  }### Answer:
@Test public void testToBaseUrl() { final String result = UrlUtils.toBaseUrl("https: assertThat(result).as("Base Url").isEqualTo("https: }
@Test public void shouldReturnBaseUrl() { final String result = UrlUtils.toBaseUrl("https: assertThat(result).as("Base Url").isEqualTo("https: }
@Test public void shouldReturnBaseUrlFromSlash() { final String result = UrlUtils.toBaseUrl("https: assertThat(result).as("Base Url").isEqualTo("https: }
@Test public void shouldReturnNullForNonUrl() { final String result = UrlUtils.toBaseUrl("some string"); assertThat(result).as("Base Url").isNull(); }