### Question:
UrlUtil { public static final String escape(final String unescaped) { if (unescaped == null) { return null; } return escape(unescaped, true); }  static final String escape(final String unescaped); static final String escape(final String unescaped, final boolean preventDoubleEscaping); static final boolean isEscaped(final String candidate);  }### Answer:
@Test public void escape_WithDoubleEscaping() { Assert.assertNull(UrlUtil.escape(null, false)); Assert.assertEquals("/content/dam/test.png", UrlUtil.escape("/content/dam/test.png", false)); Assert.assertEquals("/content/dam/test%20asset.png", UrlUtil.escape("/content/dam/test asset.png", false)); Assert.assertEquals("/content/dam/test%20asset.png/_jcr_content", UrlUtil.escape("/content/dam/test asset.png/jcr:content", false)); Assert.assertEquals("/content/dam/test%20folder/ir%c4%81%2bpu%20p%c3%b6%20%26p%c3%aep%e2%98%83.jpeg/_jcr_content/test", UrlUtil.escape("/content/dam/test folder/irā+pu pö &pîp☃.jpeg/jcr:content/test", false)); }
@Test public void escape_WithNoDoubleEscaping() { Assert.assertNull(UrlUtil.escape(null)); Assert.assertEquals("/content/dam/test.png", UrlUtil.escape("/content/dam/test.png")); Assert.assertEquals("/content/dam/test%20asset.png", UrlUtil.escape("/content/dam/test asset.png")); Assert.assertEquals("/content/dam/test%20asset.png/_jcr_content", UrlUtil.escape("/content/dam/test asset.png/jcr:content")); Assert.assertEquals("/content/dam/test%20folder/ir%c4%81%2bpu%20p%c3%b6%20%26p%c3%aep%e2%98%83.jpeg/_jcr_content/test", UrlUtil.escape("/content/dam/test folder/irā+pu pö &pîp☃.jpeg/jcr:content/test")); }
@Test public void escape_WithHost() { Assert.assertEquals("http: Assert.assertEquals("http: Assert.assertEquals("https: Assert.assertEquals("https: UrlUtil.escape("https: }
@Test public void escape_WithQueryParams() { Assert.assertEquals("http: UrlUtil.escape("http: Assert.assertEquals("http: UrlUtil.escape("http: }