@Test
public void testExecute() throws Exception {

    assertEquals("http://www.foo.com/", _sanitizer.execute("http://www.foo.com"));
    assertEquals("http://www.foo.com/path/page.cfm", _sanitizer.execute("http://www.foo.com/path/page.cfm"));
    assertEquals("http://www.foo.com/path/page.cfm?a=1&num_rooms=1&children=0&int=VA&b=2#foo",
        _sanitizer.execute("http://www.foo.com/path/page.cfm?a=1&num_rooms=1&children=0&int=VA&b=2#foo"));
    assertEquals("/path/page.cfm?a=1&num_rooms=1&children=0&int=VA&b=2",
        _sanitizer.execute("/path/page.cfm?a=1&num_rooms=1&children=0&int=VA&b=2"));
    assertEquals("/?a=1&num_rooms=1&children=0&int=VA&b=2", _sanitizer.execute("?a=1&num_rooms=1&children=0&int=VA&b=2"));
    assertEquals("/foo", _sanitizer.execute("foo"));
    assertEquals(
        "https://travel.americanexpress.co.uk/travel/itinerary_clear_process.cfm?redirect_url=%2Ftravel%2Farc.cfm%3Ftab%3Dact&nav=default",
        _sanitizer
            .execute("https://travel.americanexpress.co.uk/travel/itinerary_clear_process.cfm?redirect_url=/travel/arc.cfm?tab=act&nav=default"));
    try {
        _sanitizer.execute("<script>alert('hacked!');</script>");
        fail("Should throw URISyntaxException");
    } catch (Exception e) {
        assertEquals("java.net.URISyntaxException: Illegal character in path at index 0: <script>alert('hacked!');</script>", e.getMessage());
    }
}