3 ms·
"What do we say to the God of Unit Testing? — Not today()!" Stub out the calls responsible for reading system clock, then set it deterministically, and advanc
by nine_k 3y ago
"What do we say to the God of Unit Testing? — Not today()!"
Stub out the calls responsible for reading system clock, then set it deterministically, and advance it programmatically where a test depends on the passage of time. This works really well, reads really well in the source, and allows to test general cases and edge cases equally easily.