### Question:
UrlUtils { public static String sanitizeBaseUrl(String baseUriSpec, String uriSpec) { if (baseUriSpec != null) { URI baseUri = URI.create(baseUriSpec); try { baseUri = ensureScheme(baseUri, HTTP); URI uri = uriFromSpec(uriSpec); String scheme = uri == null || !Objects.equals(baseUri.getAuthority(), uri.getAuthority()) || !Arrays.asList(new String[]{HTTP, HTTPS}).contains(uri.getScheme()) ? baseUri.getScheme() : uri.getScheme(); if (!scheme.equals(baseUri.getScheme())) { return new URIBuilder(baseUri).setScheme(scheme).build().toString(); } } catch (URISyntaxException e) { throw new IllegalArgumentException(e.getMessage(), e); } return baseUri.toString(); } return null; } private  UrlUtils(); static String concat(String baseUriSpec, String uriSpec); static String sanitizeBaseUrl(String baseUriSpec, String uriSpec); static String getAbsoluteUrlFromFile(String file); static String getAbsoluteUrlPathFromFile(String file);  }### Answer:
@Test public void testSanitizeBaseUrl() { String baseUrl = UrlUtils.sanitizeBaseUrl("http: Assertions.assertThat(baseUrl).isEqualTo("https: }
@Test public void testSanitizeBaseUrlOtherDomain() { String baseUrl = UrlUtils.sanitizeBaseUrl("http: Assertions.assertThat(baseUrl).isEqualTo("http: }
@Test public void testSanitizeBaseUrlNull() { String baseUrl = UrlUtils.sanitizeBaseUrl(null, "https: Assertions.assertThat(baseUrl).isNull(); }
@Test public void testSanitizeBaseUrlMissingScheme() { String baseUrl = UrlUtils.sanitizeBaseUrl("fluentlenium.com/path/", "https: Assertions.assertThat(baseUrl).isEqualTo("https: }
@Test public void testSanitizeBaseUrlMissingSchemeOtherDomain() { String baseUrl = UrlUtils.sanitizeBaseUrl("fluentlenium.com/path/", "https: Assertions.assertThat(baseUrl).isEqualTo("http: }