Re:Why I don't mock
by blt on Wednesday May 28, 2014 @09:55AM
(#7809884)
I agree. But another option is to make all the methods that would call now() take an extra parameter of the current time. Talk about making your dependencies explicit...
[ Parent
| on HN ]
Re:Why I don't mock
by GrinningFool on Wednesday May 28, 2014 @10:03AM
(#7809916)
But now you've...
a) changed your interface in a way that invites use cases you never intended (or wanted) to support.
b) added branching code anywhere that requires now()