Answer the question
In order to leave comments, you need to log in
How to change time for JUnit 5 test?
I'm testing a service using JUnit 5. In the service, before performing the action, LocalTime.now() is called and it is checked that the time is now less than 11:00. For tests, I somehow need to make LocalTime.now() in the service return the time before 11:00, regardless of the real time. How can this be checked?
Answer the question
In order to leave comments, you need to log in
Maybe something will help from here: https://www.baeldung.com/java-override-system-time
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question