### Question:
CookieUtil { public static int dropCookiesByRegexArray(final HttpServletRequest request, final HttpServletResponse response, final String cookiePath, final String[] regexes) { int count = 0; if (regexes == null) { return count; } final List<Cookie> cookies = new ArrayList<Cookie>(); for (final String regex : regexes) { cookies.addAll(getCookies(request, regex)); } return dropCookies(response, cookies.toArray(new Cookie[cookies.size()]), cookiePath); } 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 testDropCookiesByRegexArray() { String[] regexes = new String[]{"(.*)mammal(.*)", "^fr.*"}; int expResult = 3; int result = CookieUtil.dropCookiesByRegex(request, response, "/", regexes); assertEquals(expResult, result); expResult = 0; result = CookieUtil.dropCookiesByRegex(request, response, "/", "nothere"); assertEquals(expResult, result); }