You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the Timer class is final, which means it cannot be mocked or extended and that's ok for general usage.
But because of this external packages cannot properly test any classes using the this timer.
Introducing an interface for the timer would fix this problem... or am I missing something?
The text was updated successfully, but these errors were encountered:
This is outside the scope of this project (as I do not have any use case where I need to isolate Timer from code that uses it for testing).
However, you should not double what you do not own. This means that you should not use Timer directly in your code. Instead, you should define an interface that you own and implement a class that implements your interface using Timer.
Currently the
Timer
class isfinal
, which means it cannot be mocked or extended and that's ok for general usage.But because of this external packages cannot properly test any classes using the this timer.
Introducing an interface for the timer would fix this problem... or am I missing something?
The text was updated successfully, but these errors were encountered: