### Question:
Urls { @Nonnull public static String escape(@Nonnull String url) { String trim = Strings.sanitizeWhitespace(url); SplitUrl split = SplitUrl.split(trim); if (split.urlType() != Type.FULL) { throw new IllegalArgumentException( "Not a full URL: " + url); } StringBuilder sb = new StringBuilder(); if (split.scheme() != null) { String scheme = split.scheme().toLowerCase(Locale.US); if (scheme.equals("http") || scheme.equals("https")) { sb.append(scheme).append(':'); } else { throw new IllegalArgumentException( "Only http and https schemes are supported. Input: " + url); } } if (split.authority() != null) { sb.append(" } if (split.path() != null) { sb.append(PercentEncoder.reEncodePath(split.path()).replace('\\', '/')); } if (split.query() != null) { sb.append('?').append(PercentEncoder.reEncodeQuery(split.query())); } if (split.fragment() != null) { sb.append('#').append(PercentEncoder.reEncodeFragment(split.fragment())); } return sb.toString(); } private  Urls(); @Nonnull static URI createURI(@Nonnull String fullUrl); @Nonnull static String escape(@Nonnull String url); static UrlBuilder http(String host); static UrlBuilder https(String host); @Nonnull static Url parse(String url);  }### Answer:
@Test public void minimalEscapeTrimsWhitespace() { String expected = "http: assertEquals(expected, Urls.escape(" http: assertEquals(expected, Urls.escape(" http: assertEquals(expected, Urls.escape(" http: assertEquals(expected, Urls.escape("\thttp: assertEquals(expected, Urls.escape("\fhttp: assertEquals(expected, Urls.escape("\fhttp: }
@Test public void minimalEscapeRemovesLineBreaks() { String expected = "http: assertEquals(expected, Urls.escape("http: assertEquals(expected, Urls.escape("http: assertEquals(expected, Urls.escape("http: assertEquals(expected, Urls.escape("http: assertEquals(expected, Urls.escape("http: }
@Test public void minimalEncodeToLowerCase() { assertEquals("http: }
@Test public void minimalEncodeHostname() { assertEquals("http: assertEquals("http: assertEquals("http: assertEquals("http: assertEquals("http: assertEquals("http: assertEquals("http: }
@Test public void minimalEncodeChecksAuthority() { try { Urls.escape("http: fail("Expected IllegalArgumentException"); } catch (IllegalArgumentException expected) { assertThat(expected.getMessage(), containsString("Invalid hostname:")); } }
@Test public void minimalEncodeFixColonSlashSlash() { String expected = "http: assertEquals(expected, Urls.escape("http: assertEquals(expected, Urls.escape("http:/host")); assertEquals(expected, Urls.escape("http:\\host")); assertEquals(expected, Urls.escape("http:\\\\host")); }
@Test public void minimalEscape_retainPlusInPath() { assertEquals("http: }
@Test public void minimalEscape_retainPlusInQiuery() { assertEquals("http: }