refactor mocking