### Question:
CookieUtil { public static Cookie getCookie(final HttpServletRequest request, final String cookieName) { if (StringUtils.isBlank(cookieName)) { return null; } final Cookie[] cookies = request.getCookies(); if (cookies == null) { return null; } if (cookies.length > 0) { for (final Cookie cookie : cookies) { if (StringUtils.equals(cookieName, cookie.getName())) { return cookie; } } } return null; } 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 testGetCookie() { String cookieName = "snake"; Cookie expResult = null; Cookie result = CookieUtil.getCookie(request, cookieName); assertEquals(expResult, result); cookieName = "dog-mammal"; expResult = dogCookie; result = CookieUtil.getCookie(request, cookieName); assertEquals(expResult, result); }