test code refactoring