refactoring test code