Better mocking for tests