### Question:
CookieParser { public static Map<CookieNameEnum, CookieNameHelper> loadCookie(HttpServletRequest request) { Map<CookieNameEnum, CookieNameHelper> allValues = new HashMap<CookieNameEnum, CookieNameHelper>(); Map<String, String> cookieKV = CookieUtils.arrayToMap(request.getCookies()); for (CookieNameEnum cookieName : CookieNameEnum.values()) { CookieNameConfig cookieNameConfig = CookieNamePolicyParser.getCookieNamePolicyMap().get(cookieName); boolean isCookieExisted = cookieKV.containsKey(cookieNameConfig.getCookieName()); if (isCookieExisted) { String value = cookieKV.get(cookieName.getCookieName()); CookieNameHelper cookieNameHelper = paserCookieValue(cookieNameConfig, value); if (cookieNameHelper != null) { allValues.put(cookieName, cookieNameHelper); } } } return allValues; }  static Map<CookieNameEnum, CookieNameHelper> loadCookie(HttpServletRequest request);  }### Answer:
@Ignore @Test public void loadCookie() { HttpServletRequest request = EasyMock.createMock(HttpServletRequest.class); Cookie[] cookies = new Cookie[] { new Cookie(CookieNameEnum.msun_cookie_forever.getCookieName(), CookieUtils.encrypt("c_id=1")), new Cookie(CookieNameEnum.msun_last_login.getCookieName(), CookieUtils.encrypt("l_t=2")) }; EasyMock.expect(request.getCookies()).andReturn(cookies); EasyMock.replay(request); Map<CookieNameEnum, CookieNameHelper> allCookieValues = CookieParser.loadCookie(request); Assert.assertTrue(allCookieValues.size() == 2); String cookieValue1 = allCookieValues.get(CookieNameEnum.msun_cookie_forever).getValue(CookieKeyEnum.cookie_id); String cookieValue2 = allCookieValues.get(CookieNameEnum.msun_last_login).getValue(CookieKeyEnum.last_access_time); Assert.assertTrue("1".equals(cookieValue1)); Assert.assertTrue("2".equals(cookieValue2)); }