Fix up test and mocking code.