Relative Content

Tag Archive for javaspring-bootunit-testingjwtmockito

JWTService testing

I’m learning to test my code. I want to test my JWTService. First of all, I want to test the generateJwtToken method for the following scenarios: 1- token generated, 2- token not generated. But the class has dependencies on private methods and data from environment variables. How can I simulate loading the secret key and calling private methods in the test class? Here’s the code of my JWTService