I\'m writing some code that does date and time calculations against the current time. In Joda time, this is accessed through a (Java) constructor, as it is an immutable obje
I know this as already been accepted, but with Joda-time you can freeze and set it to be whatever you like. So you can freeze time, advance time, go backwards in time. Provided you're using Joda consistently, your objects will get "now" as whatever time you've set that to be.
// Stop time (and set a particular point in time):
DateTimeUtils.setCurrentMillisFixed(whenever);
// Advance time by the offset:
DateTimeUtils.setCurrentMillisOffset(offsetFromCurrent);
// Restore time (you could do this in an @After method)
DateTimeUtils.setCurrentMillisSystem();