Refactoring, without test coverage, in a nutshell.
Definitely adding this one to the dev guidelines on unit and integration tests. 👍🏼
You don’t always have test coverage to help and test coverage doesn’t always help for some deep refactors.
Often I find myself on the wrong end of the legacy code stick, and need to refactor a god awful mess into something debuggable, nevermind testable.
I don’t think I’ve met a codebase that had tests that would work with the level of refactoring that would need to be done. I mean let’s be honest here, if it was well architected, refactoring wouldn’t be like the comic. It’s probably a mess of entangled concerns and bad inheritance.
For that matter the code most in need of refactoring probably has shit tests and that just
assertNotNull
on the happy path to appease sonar and be done with it.