Fix mock and stub deprecation warnings.