ServletFilterRequest extends DiscFilterRequest { @Override public void clearCookies() { parent.removeHeaders(HttpHeaders.Names.COOKIE); } ServletFilterRequest(ServletRequest parent); void setUri(URI uri); @Override String getMethod(); @Override void setRemoteAddr(String remoteIpAddress); @Override Enumeration<String> getAttributeNames(); @Override Object getAttribute(String name); @Override void setAttribute(String name, Object value); @Override boolean containsAttribute(String name); @Override void removeAttribute(String name); @Override String getParameter(String name); @Override Enumeration<String> getParameterNames(); @Override void addHeader(String name, String value); @Override String getHeader(String name); @Override Enumeration<String> getHeaderNames(); List<String> getHeaderNamesAsList(); @Override Enumeration<String> getHeaders(String name); @Override List<String> getHeadersAsList(String name); @Override void setHeaders(String name, String value); @Override void setHeaders(String name, List<String> values); @Override Principal getUserPrincipal(); @Override void setUserPrincipal(Principal principal); @Override List<X509Certificate> getClientCertificateChain(); @Override void removeHeaders(String name); @Override void clearCookies(); @Override void setCharacterEncoding(String encoding);  }
@Test public void cookies_can_be_added_and_removed() { Cookie cookie = new Cookie("name", "value"); filterRequest.addCookie(JDiscCookieWrapper.wrap(cookie)); assertEquals(filterRequest.getCookies(), Collections.singletonList(cookie)); assertEquals(parentRequest.getCookies().length, 1); javax.servlet.http.Cookie servletCookie = parentRequest.getCookies()[0]; assertEquals(servletCookie.getName(), cookie.getName()); assertEquals(servletCookie.getValue(), cookie.getValue()); filterRequest.clearCookies(); assertTrue(filterRequest.getCookies().isEmpty()); assertEquals(parentRequest.getCookies().length, 0); }