Guava has a pretty cool Ticker concept . Unfortunately, it looks like it was designed around creating nanosecond focused stopwatch to measure runtime.
I would like to find something similar, because it makes it easier to test classes that are sensitive to time changes. I ran into a problem historically when I used System.currentTimeMillis()it because it is difficult to simulate the time taken to pass the test. I was thinking of using a similar interface with what Guava has, but measures time in milliseconds instead, as this corresponds to more libraries available.
I wanted to ask if anyone saw something like this or has other suggestions before I write it myself.
source
share