### Question:
SessionUserIdSource implements UserIdSource { @Override public String getUserId() { return RequestContextHolder.currentRequestAttributes().getSessionId(); }  @Override String getUserId();  }### Answer:
@Test public void getUserId() throws Exception { MockHttpServletRequest request = new MockHttpServletRequest(); MockHttpSession session = new MockHttpSession() { @Override public String getId() { return "535510n1D"; } }; request.setSession(session); RequestAttributes attributes = new ServletWebRequest(request); RequestContextHolder.setRequestAttributes(attributes); SessionUserIdSource source = new SessionUserIdSource(); assertEquals("535510n1D", source.getUserId()); }