use of org.springframework.security.Authentication in project gocd by gocd.
the class UserHelperTest method stubSecurityContextForGrantedAuthorities.
private static void stubSecurityContextForGrantedAuthorities(GrantedAuthority[] grantedAuthorities) {
SecurityContext context = mock(SecurityContext.class);
Authentication authentication = mock(Authentication.class);
when(context.getAuthentication()).thenReturn(authentication);
when(authentication.getAuthorities()).thenReturn(grantedAuthorities);
SecurityContextHolder.setContext(context);
}
Aggregations