Add utility function to ease mocking constructors.