RateLimitFilter implements javax.servlet.Filter { @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain) throws IOException, ServletException { if (rateLimit.filter(servletRequest, servletResponse)) { return; } chain.doFilter(servletRequest, servletResponse); } RateLimitFilter(); @Override void destroy(); @Override void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain); @Override void init(FilterConfig config);  }
@Test public void testDefaultRateLimitFilter() { RateLimitFilter filter = new RateLimitFilter(); assertNotNull(filter); MockHttpServletRequest request = new MockHttpServletRequest(); request.setMethod("GET"); request.setRequestURI("/"); MockHttpServletResponse response = new MockHttpServletResponse(); RateLimitFilterChain chain = new RateLimitFilterChain(); try { filter.doFilter(request, response, chain); } catch (IOException | ServletException e) { fail(); } assertEquals(response.getStatus(), 200); }