public static SecurityContext getContext() {
SecurityContext context = new SecurityContextImpl();
MockHttpServletRequest request = new MockHttpServletRequest();
request.setRemoteAddr("localhost");
List<GrantedAuthority> list = Lists.newArrayList((GrantedAuthority) new GrantedAuthorityImpl("role_foo"));
User user = new User(USER_NAME, "bar", false, false, false, false, list);
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(user, null,
list);
authentication.setDetails(new WebAuthenticationDetails(request));