### Question:
HttpEventTask implements Runnable { 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; } HttpEventTask(Socket socket); void close(); @Override void run(); static final String SERVER_ERROR_MESSAGE; static final String INVALID_COMMAND_MESSAGE; }### Answer:
@Test public void removeAnchor() { assertNull(HttpEventTask.removeAnchor(null)); assertEquals("", HttpEventTask.removeAnchor("")); assertEquals("", HttpEventTask.removeAnchor("#mark")); assertEquals("a", HttpEventTask.removeAnchor("a#mark")); }