2. Problems
System is static
hard to mock
time/duration is unpredictable
when is now
how long does it take (to run a test)
we can introduce an error margin
is it big enough
...
3. Solution
Don't use System.getCurrentMillis()
for Data
use Data: timestamps, duration (e.g. Joda Time)
objects are better then primitives
for Services/Beans
IClock injected interface
ActiveClock: production (thin wrapper)
StoppedClock: test
startTimestamp
tick()/advance()