### Question:
AuthCheckFilter implements Filter { public static boolean testURLPassesExclude(String url, String exclude) { if (exclude.endsWith("*")) { if (url.startsWith(exclude.substring(0, exclude.length()-1))) { if (!url.contains("..") && !url.toLowerCase().contains("%2e")) { return true; } } } else if (exclude.contains("?")) { if (url.equals(exclude)) { return true; } } else { int paramIndex = url.indexOf("?"); if (paramIndex != -1) { url = url.substring(0, paramIndex); } if (url.equals(exclude)) { return true; } } return false; } AuthCheckFilter();   AuthCheckFilter(final AdminManager adminManager, final LoginLimitManager loginLimitManager); static AuthCheckFilter getInstance(); static boolean isServletRequestAuthenticatorInstanceOf(Class<? extends ServletRequestAuthenticator> clazz); static void addExclude(String exclude); static void removeExclude(String exclude); static boolean testURLPassesExclude(String url, String exclude); @Override void init(FilterConfig config); @Override void doFilter(ServletRequest req, ServletResponse res, FilterChain chain); @Override void destroy(); static final SystemProperty<Class> SERVLET_REQUEST_AUTHENTICATOR; }### Answer:
@Test public void testExcludeRules() { assertFalse(AuthCheckFilter.testURLPassesExclude("blahblah/login.jsp", "login.jsp")); assertTrue(AuthCheckFilter.testURLPassesExclude("login.jsp", "login.jsp")); assertTrue(AuthCheckFilter.testURLPassesExclude("login.jsp?yousuck&blah", "login.jsp")); assertTrue(AuthCheckFilter.testURLPassesExclude("login.jsp?another=true&login.jsp?true", "login.jsp")); assertFalse(AuthCheckFilter.testURLPassesExclude("blahblah/login.jsp", "login.jsp?logout=false")); assertTrue(AuthCheckFilter.testURLPassesExclude("login.jsp?logout=false", "login.jsp?logout=false")); assertFalse(AuthCheckFilter.testURLPassesExclude("login.jsp?logout=false&another=true", "login.jsp?logout=false")); assertFalse(AuthCheckFilter.testURLPassesExclude("login.jsp?logout=false&another=true", "login.jsp?logout=false")); assertFalse(AuthCheckFilter.testURLPassesExclude("setup/setup-/../../log.jsp?log=info&mode=asc&lines=All","setup/setup-*")); assertFalse(AuthCheckFilter.testURLPassesExclude("setup/setup-/%2E/%2E/log.jsp?log=info&mode=asc&lines=All","setup/setup-*")); assertTrue(AuthCheckFilter.testURLPassesExclude("setup/setup-new.jsp","setup/setup-*")); assertFalse(AuthCheckFilter.testURLPassesExclude("another.jsp?login.jsp", "login.jsp")); }