Improved code style for test mock'd side effects