【发布时间】:2014-04-04 08:21:52
【问题描述】:
我正在尝试对UIButton 上的选定属性进行存根。 getter 定义为:
@property (nonatomic, getter=isSelected) BOOL selected;
我的存根看起来像这样:
[[[button stub] andReturnValue:OCMOCK_VALUE(TRUE)] isSelected];
我在运行测试时收到以下错误:
Return value does not match method signature; signature declares 'c' but value is 'i'.
我认为这与 getter=isSelected 部分有关,但不确定发生了什么
是否可以存根这种类型的 getter?
【问题讨论】:
-
对于这种特殊情况,使用真正的 UIButton 并正常设置 selected 属性会不会更好?
标签: ios unit-testing ocmock