refactoring test code.