Factor out mocking code to be shared