0
objCプロジェクトでOCMockを使用しています。OCMockを使ってメソッドをスタブする
私は、次のコードを持っている:
DB_Account *Lena = [[DB_Account alloc] init];
Lena.niceName = @"Lena";
Lena.userId = @"Lena";
id mockStorageManager = OCMClassMock([V4_StorageManager class]);
[[[mockStorageManager stub] andReturn:Lena] getAccountByDBId:@1];
id mockDBNotificationManager = OCMClassMock([DBNotificationManager class]);
id partialV4DBNotificationManagerMock = OCMPartialMock([V4_DBNotificationManager manager]);
[[[mockDBNotificationManager stub] andReturn:(NotificationPolicy *)[NotificationPolicy Never]] getNotificationPolicy];
[[[partialV4DBNotificationManagerMock stub] andReturn:mockDBNotificationManager] dbNotificationManager];
BOOL shouldShow = [[V4_DBNotificationManager manager] showOnLoginExpired:Lena];
assertThatBool(shouldShow,is(isFalse()));
このコードは次の行にコンパイルすることができない:このエラーで
[[[mockDBNotificationManager stub] andReturn:(NotificationPolicy *)[NotificationPolicy Never]] getNotificationPolicy];
:
Error:(95, 5) multiple methods named 'getNotificationPolicy' found with mismatched result, parameter type or attributes
この方法は、オブジェクトを返しますNotificationPolicy *型の他のクラスは、この名前のメソッドを実装または宣言しません。
どうしたのですか?