Hi,
I often find myself changing my code to make it more testable, I always wonder whether this is a good idea or not. Some of the things I find myself doing are:
- Adding setters just so I can set an internal object to a mock.
- Adding getters for internal maps/lists so I can check the internal state of the object has changed after performing some external action.
- Wrapping concrete system classes and creating a new interface so I can mock them. For example, File classes can be hard to mock - so I'll create a new interface FileInterface and WrappedFile which extends it and then use the FileInterface instead of File.