I'm writing core service for a small system. There is a usecase where user can request password reset. This means that random value is sent to him via email. I want to test this method, but I can't leak this value from the core. It seems that the only way to do it properly is to create a @Component with single method, something like getRandomString() and mock it. But it seems a little excessive. Is there a better way to do it? Of course creating separate component/service and initializing it with constant seed is an option, but I'd like to avoid creating new entities. Any ideas?
Aucun commentaire:
Enregistrer un commentaire