@UsernameAlreadyExists
private String username;
I have a custom validator that I created to ensure that duplicate usernames are caught by the appli
You cannot mock the ConstraintValidator but you certainly can mock the service that the validator depends on, using the usual spring ways of mocking beans, for eg.:
.1. Potentially define a mock instance with the exact same bean name, ensuring that your config with mock gets loaded after the real instance.
.2. Test with only the test configuration with only the mock bean defined.