protected static String removeAnchor(String str) {
        if (str == null || str.length() == 0) {
            return str;
        }

        int anchor = str.indexOf('#');

        if (anchor == 0) {
            return "";
        } else if (anchor > 0) {
            return str.substring(0, anchor);
        }

        return str;
    }
@Test
    public void removeAnchor() {
        assertNull(HttpEventTask.removeAnchor(null));
        assertEquals("", HttpEventTask.removeAnchor(""));
        assertEquals("", HttpEventTask.removeAnchor("#mark"));
        assertEquals("a", HttpEventTask.removeAnchor("a#mark"));
    }