3 ms·
Catching date-related failures before they become critical (2013)
- fidz 12y agoSo instead of boolean needToUninstall() { if now > EXPIRATION_TIME return true else return false } we need to boolean needToUninstall(givenTime) { if givenTime > EXPIRATION_TIME return true else return false } needToUninstall(now) && doUninstall() so the code is now testable. Or simply use dependency injection to change the value of `now` Is it hard to pass time as parameter?