code refactoring for test case code