Unit tests code refactoring