0

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

id objectOne = [ObjectOne objectWithAnotherObject:objectTwo];

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

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

ObjectTwo *objectTwo = [ObjectTwo 模拟];

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

id objectOne = [ObjectOne objectWithAnotherObject:objectTwo];

我现在面临的问题是例外:

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

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

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

4

1 回答 1

1

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

于 2014-10-15T19:11:28.313 回答