@Test public void shouldReturnEmptyCollectionIfNoCookiesInUnderlyingRequest() { when(mockHttpRequest.getCookies()) .thenReturn(new javax.servlet.http.Cookie[0]); PippoWebContext context = makePippoWebContext(); Collection<Cookie> cookies = context.getRequestCookies(); assertTrue(cookies.isEmpty()); verify(mockHttpRequest, times(1)).getCookies(); }
@Override public Collection<Cookie> getRequestCookies() { return getRequest().getCookies().stream().map(c -> { Cookie cookie = new Cookie(c.getName(), c.getValue()); cookie.setComment(c.getComment()); cookie.setSecure(c.getSecure()); cookie.setPath(c.getPath()); cookie.setHttpOnly(c.isHttpOnly()); cookie.setDomain(c.getDomain()); cookie.setMaxAge(c.getMaxAge()); cookie.setVersion(c.getVersion()); return cookie; }).collect(Collectors.toList()); }
PippoWebContext implements WebContext { @Override public Collection<Cookie> getRequestCookies() { return getRequest().getCookies().stream().map(c -> { Cookie cookie = new Cookie(c.getName(), c.getValue()); cookie.setComment(c.getComment()); cookie.setSecure(c.getSecure()); cookie.setPath(c.getPath()); cookie.setHttpOnly(c.isHttpOnly()); cookie.setDomain(c.getDomain()); cookie.setMaxAge(c.getMaxAge()); cookie.setVersion(c.getVersion()); return cookie; }).collect(Collectors.toList()); } }
PippoWebContext implements WebContext { @Override public Collection<Cookie> getRequestCookies() { return getRequest().getCookies().stream().map(c -> { Cookie cookie = new Cookie(c.getName(), c.getValue()); cookie.setComment(c.getComment()); cookie.setSecure(c.getSecure()); cookie.setPath(c.getPath()); cookie.setHttpOnly(c.isHttpOnly()); cookie.setDomain(c.getDomain()); cookie.setMaxAge(c.getMaxAge()); cookie.setVersion(c.getVersion()); return cookie; }).collect(Collectors.toList()); } PippoWebContext(RouteContext routeContext);  PippoWebContext(RouteContext routeContext, SessionStore<PippoWebContext> sessionStore); }
PippoWebContext implements WebContext { @Override public Collection<Cookie> getRequestCookies() { return getRequest().getCookies().stream().map(c -> { Cookie cookie = new Cookie(c.getName(), c.getValue()); cookie.setComment(c.getComment()); cookie.setSecure(c.getSecure()); cookie.setPath(c.getPath()); cookie.setHttpOnly(c.isHttpOnly()); cookie.setDomain(c.getDomain()); cookie.setMaxAge(c.getMaxAge()); cookie.setVersion(c.getVersion()); return cookie; }).collect(Collectors.toList()); } PippoWebContext(RouteContext routeContext);  PippoWebContext(RouteContext routeContext, SessionStore<PippoWebContext> sessionStore); @Override SessionStore<PippoWebContext> getSessionStore(); @Override void setSessionStore(SessionStore sessionStore); @Override String getRequestParameter(String name); @Override Map<String, String[]> getRequestParameters(); @Override Object getRequestAttribute(String name); @Override void setRequestAttribute(String name, Object value); @Override String getRequestHeader(String name); @Override String getRequestMethod(); @Override String getRemoteAddr(); @Override void writeResponseContent(String contentToWrite); @Override void setResponseStatus(int statusCode); @Override void setResponseHeader(String name, String value); @Override void setResponseContentType(String contentType); @Override String getServerName(); @Override int getServerPort(); @Override String getScheme(); @Override boolean isSecure(); @Override String getFullRequestURL(); @Override Collection<Cookie> getRequestCookies(); @Override void addResponseCookie(Cookie cookie); @Override String getPath(); RouteContext getRouteContext(); Request getRequest(); Response getResponse(); }
PippoWebContext implements WebContext { @Override public Collection<Cookie> getRequestCookies() { return getRequest().getCookies().stream().map(c -> { Cookie cookie = new Cookie(c.getName(), c.getValue()); cookie.setComment(c.getComment()); cookie.setSecure(c.getSecure()); cookie.setPath(c.getPath()); cookie.setHttpOnly(c.isHttpOnly()); cookie.setDomain(c.getDomain()); cookie.setMaxAge(c.getMaxAge()); cookie.setVersion(c.getVersion()); return cookie; }).collect(Collectors.toList()); } PippoWebContext(RouteContext routeContext);  PippoWebContext(RouteContext routeContext, SessionStore<PippoWebContext> sessionStore); @Override SessionStore<PippoWebContext> getSessionStore(); @Override void setSessionStore(SessionStore sessionStore); @Override String getRequestParameter(String name); @Override Map<String, String[]> getRequestParameters(); @Override Object getRequestAttribute(String name); @Override void setRequestAttribute(String name, Object value); @Override String getRequestHeader(String name); @Override String getRequestMethod(); @Override String getRemoteAddr(); @Override void writeResponseContent(String contentToWrite); @Override void setResponseStatus(int statusCode); @Override void setResponseHeader(String name, String value); @Override void setResponseContentType(String contentType); @Override String getServerName(); @Override int getServerPort(); @Override String getScheme(); @Override boolean isSecure(); @Override String getFullRequestURL(); @Override Collection<Cookie> getRequestCookies(); @Override void addResponseCookie(Cookie cookie); @Override String getPath(); RouteContext getRouteContext(); Request getRequest(); Response getResponse();  }