Refactoring Java Code for Unit Testing