LoginStrategyImpl extends LoginStrategy { @Override public String getUserId(HttpServletRequest request) throws PortalAPIException { Cookie ep = getCookie(request, EP_SERVICE); if (ep == null) { logger.debug(EELFLoggerDelegate.debugLogger, "getUserId: no EP_SERVICE cookie, returning null"); return null; } String userid = null; try { userid = getUserIdFromCookie(request); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "getUserId failed", e); } return userid; }  @Override ModelAndView doLogin(HttpServletRequest request, HttpServletResponse response); @Override String getUserId(HttpServletRequest request);  }
@Test public void testLoginStrategyImpl() throws PortalAPIException { LoginStrategyImpl impl = new LoginStrategyImpl(); MockHttpServletRequest request = new MockHttpServletRequest(); Cookie cookie1 = new Cookie("EPService", "serviceName"); Cookie cookie2 = new Cookie("UserId", "userName"); request.setCookies(cookie1, cookie2); assertNull(impl.getUserId(request)); }