### Question:
CookieUtil { public static boolean extendCookieLife(final HttpServletRequest request, final HttpServletResponse response, final String cookieName, final String cookiePath, final int expiry) { final Cookie cookie = getCookie(request, cookieName); if (cookie == null) { return false; } if (cookie.getMaxAge() <= 0) { return false; } final Cookie responseCookie = (Cookie) cookie.clone(); responseCookie.setMaxAge(expiry); responseCookie.setPath(cookiePath); addCookie(responseCookie, response); return true; } private  CookieUtil(); static boolean addCookie(final Cookie cookie, final HttpServletResponse response); static Cookie getCookie(final HttpServletRequest request, final String cookieName); static List<Cookie> getCookies(final HttpServletRequest request, final String regex); static boolean extendCookieLife(final HttpServletRequest request, final HttpServletResponse response,
                                           final String cookieName, final String cookiePath, final int expiry); static int dropCookies(final HttpServletRequest request, final HttpServletResponse response, final String cookiePath, final String... cookieNames); static int dropCookiesByRegex(final HttpServletRequest request, final HttpServletResponse response, final String cookiePath, final String... regexes); static int dropCookiesByRegexArray(final HttpServletRequest request, final HttpServletResponse response, final String cookiePath, final String[] regexes); static int dropAllCookies(final HttpServletRequest request, final HttpServletResponse response, final String cookiePath);  }### Answer:
@Test public void testExtendCookieLife() { String cookieName = "tortoise"; int expiry = 1000; boolean expResult = true; boolean result = CookieUtil.extendCookieLife(request, response, cookieName, "/", expiry); assertEquals(expResult, result); cookieName = "dodo"; expResult = false; result = CookieUtil.extendCookieLife(request, response, cookieName, "/", expiry); assertEquals(expResult, result); }