code refactoring for client test cases