There should be a SecurityMockMvcResultMatchers.withAuthorities(String...)
method which does not care about the GrantedAuthority
implementation.
If the currently authenticated user has a custom GrantedAuthority
implementation with the GrantedAuthority#getAuthority()
of CUSTOM
, then the following should work:
this.mockMvc.perform(formLogin().user("custom"))
.andExpect(authenticated().withAuthorities("CUSTOM"));