Re:Six Years of Professional Clojure
by lkitching on Monday August 02, 2021 @03:26PM
(#28041454)
In my experience the need to mock out individual methods like this is an indication that the code is badly structured in the first place. The time source is effectively a global variable so in this example you'd want to pass the time as a parameter to `sayCurrentTime` and avoid the need to mock anything in the first place. A lot of C#/java codebases do seem to make excessive use of mocks and DI in this way though.
[ Parent
| on HN ]
There are no comments on this comment yet.