gpt4 book ai didi

ios - 新西兰 stub 和返回问题

转载 作者:行者123 更新时间:2023-11-29 02:35:49 25 4
gpt4 key购买 nike

我想使用 Kiwi 测试对象的创建。考虑这样的构造

id objectOne = [ObjectOne objectWithAnotherObject:objectTwo];

在这个静态方法中,我从 objectTwo 设置了我的 objectOne,它定义了枚举/类型属性。

我的 Kiwi 测试看起来像这样。

ObjectTwo *objectTwo = [ObjectTwo mock];

[objectTwo stub:@selector(type) andReturn:theValue(typeOne)];

id objectOne = [ObjectOne objectWithAnotherObject:objectTwo];

我现在面临的问题是异常(exception):

[NSException raise:@"KWStubException" format:@"wrapped stub value type (%s) could not be converted to the target type (%s)", [self.value objCType], objCType];

这是否意味着 Kiwi 无法将对象 theValue(typeOne) 转换回枚举值?

我正在使用 XCODE 6 和最新的 Kiwi 版本

最佳答案

作为解决方案,键入 @(typeOne) 而不是 theValue(typeOne)

关于ios - 新西兰 stub 和返回问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26386755/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com