I am testing a method which contain sleep in side it.What is the way to stop invoke sleep() as it makes testing slow?? Answer There is no easy way for doing this. You have several options. The easiest one would be to make the REQUEST_STATUS_CHECK_INTERVAL configurable and configure it to 0 in tests. It can be a property of the
Tag: thread-sleep
How do I make a delay in Java?
I am trying to do something in Java and I need something to wait / delay for an amount of seconds in a while loop. I want to build a step sequencer. How do I make a delay in Java? Answer If you want to pause then use java.util.concurrent.TimeUnit: To sleep for one second or To sleep for a minute.