java - Time dependent unit tests -
i need test function result depend on current time (using joda time's isbeforenow() ). public boolean isavailable() { return (this.somedate.isbeforenow()); } is possible stub/mock out system time mockito can reliably test function? joda time supports setting "fake" current time through setcurrentmillisfixed , setcurrentmillisoffset methods of datetimeutils class. see http://joda-time.sourceforge.net/api-release/org/joda/time/datetimeutils.html