3 ms·
So instead of boolean needToUninstall() { if now > EXPIRATION_TIME return true else return false } we ne
by fidz 12y ago
So 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?