我有一个具有类方法的 UIColor 类别
+(UIColor *)appropriateTextColorForBackground:(UIColor *)background
{
//...get brightness value
if (brightness > 127.5f)
return [UIColor blackColor];
else
return [UIColor whiteColor];
}
我想在我的测试类中使用 OCMockito 进行测试
-(void)testAppropriateColorWithBlackShouldReturnWhiteColor
{
Class color = mockClass([UIColor class]);
[color appropriateTextColorForBackground:black];
assertThat([color testColorWithColor:black], is([UIColor whiteColor]));
}
但我得到了错误
test failure: -: *** -[NSProxy doesNotRecognizeSelector:appropriateTextColorForBackground:] called!
我错过了什么?看来这应该可行