Closed arend-von-reinersdorff closed 8 years ago
Thanks - Clock is definitely worth mentioning.
As the purpose of MillisProvider seems to be update some static state within joda time I think it is probably better not to point people towards it. An explicit dependency on a strategy that provides the current time would be better.
@arend-von-reinersdorff Is there anything you'd like to add on this or should I close the issue?
Very nice - thanks for the update :-)
Regarding unit testing and date/time https://ncrcoe.gitbooks.io/java-for-small-teams/content/tests/2300_testing_FAQS.html
There's a new class java.time.Clock available for this in Java 8. With static methods
systemDefaultZone()
for production and fixed() to get afixed()
time for unit tests.Joda Time has MillisProvider. Unfortunately it's only an interface so one has to implement a production implementation for the current time oneself.