Mocking and Refactoring Legacy code