In Spring security test, I have seen some example test using @WithMockUser and @WithUserDetail.
I still don't understand their differences from all the documentations online.
To my knowledge:
1) @WithMockUser uses a mock user with a default role "ROLE_USER" to access a method which authorizes ROLE_USER only.
2) @WithUserDetail uses an existing username retrieved from UserDetail bean object in Spring context. It does not need to check the password and authority of that user.