refactoring a test code.