Catching date-related failures before they become critical (2013)
rachelbythebay.com
rachelbythebay.com
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?