Much legacy code is not designed with testability in mind
Refactoring can improve it so it's more testable
Catch-22: Refactoring with confidence requires a good test suite
All I can say is be careful.
Most automated refactoring tools for Java at least are fairly reliable.