Unit testing refactoring