### Question:
PostRedirectGetWithCookiesFormHelperImpl extends PostRedirectGetFormHelperImpl implements PostRedirectGetWithCookiesFormHelper { @Override protected final String encode(String unencoded) { try { return StringUtils.isBlank(unencoded) ? "" : URLEncoder.encode(unencoded, "UTF-8"); } catch (UnsupportedEncodingException ex) { log.error("Cannot encode '{}' to UTF-8", unencoded, ex); return unencoded; } }  @Override final void sendRedirect(Form form, String path, String formSelector, SlingHttpServletResponse response); @Override final void sendRedirect(Form form, Page page, String formSelector, SlingHttpServletResponse response); @Override final void sendRedirect(Form form, Resource resource, String formSelector,
            SlingHttpServletResponse response); static final int COOKIE_MAX_AGE; static final String ROOT_COOKIE_PATH; }### Answer:
@Test public void shouldInvalidateCookieOnGetRequest() throws Exception { final SlingHttpServletResponse redirectResponse = spy(slingContext.response()); request.setMethod("GET"); request.addCookie(new Cookie("f_x", encode("{\"n\":\"x\", \"f\": {\"hello\": \"world\"}}"))); formHelper.getForm("x", request, redirectResponse); verify(redirectResponse).addCookie(cookieCaptor.capture()); assertThat(cookieCaptor.getValue().getMaxAge(), is(0)); }
@Test public void shouldRemoveCookieDataOnGetRequest() throws Exception { final SlingHttpServletResponse redirectResponse = spy(slingContext.response()); request.setMethod("GET"); request.addCookie(new Cookie("f_x", encode("{\"n\":\"x\", \"f\": {\"hello\": \"world\"}}"))); formHelper.getForm("x", request, redirectResponse); verify(redirectResponse).addCookie(cookieCaptor.capture()); assertThat(cookieCaptor.getValue().getMaxAge(), is(0)); }