DiscFilterResponse { public void addCookie(JDiscCookieWrapper cookie) { if(cookie != null) { List<Cookie> cookies = new ArrayList<>(); List<Cookie> c = getCookies(); if((c != null) && (! c.isEmpty())) { cookies.addAll(c); } cookies.add(cookie.getCookie()); setCookies(cookies); } } DiscFilterResponse(ServletOrJdiscHttpResponse parent); Enumeration<String> getAttributeNames(); Object getAttribute(String name); void setAttribute(String name, Object value); void removeAttribute(String name); HeaderFields getUntreatedHeaders(); List<Cookie> getUntreatedCookies(); abstract void setHeader(String name, String value); abstract void removeHeaders(String name); abstract void setHeaders(String name, String value); abstract void setHeaders(String name, List<String> values); abstract void addHeader(String name, String value); abstract String getHeader(String name); List<Cookie> getCookies(); abstract void setCookies(List<Cookie> cookies); int getStatus(); abstract void setStatus(int status); HttpResponse getParentResponse(); void addCookie(JDiscCookieWrapper cookie); void sendError(int errorCode); void setCookie(String name, String value);  }
@Test public void testAddCookie() { URI uri = URI.create("http: HttpRequest httpReq = newRequest(uri, HttpRequest.Method.GET, HttpRequest.Version.HTTP_1_1); HttpResponse httpResp = newResponse(httpReq, 200); DiscFilterResponse response = new JdiscFilterResponse(httpResp); response.addCookie(JDiscCookieWrapper.wrap(new Cookie("name", "value"))); List<Cookie> cookies = response.getCookies(); Assert.assertEquals(cookies.size(),1); Assert.assertEquals(cookies.get(0).getName(),"name"); }