I'm creating an application which adds some local notifications. This is my test
- (void)testFirstLogin {
//some initials array
NSArray *withoutFriends = @[@"a", @"b", @"c", @"e", @"f"];
NSArray *withFriends = @[@"v", @"w", @"x", @"y", @"z"];
//my service which add local notifications
LocalNotificationService *service = [LocalNotificationService sharedInstance];
service.lastLoginDate = nil;
//UIApplication mock
UIApplication *application = mock([UIApplication class]);
service.applictation = application;
//method which adds notifications
[service addNotificationScheduleFirstLoginWithNoFriendsArray:withoutFriends friendsExistArray:withFriends];
//In this method I create UILocalNotification
/*
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
localNotification.alertBody = text;
*/
//and add it to schedule
//[self.applictation scheduleLocalNotification:localNotification];
[verifyCount(application, times(1)) scheduleLocalNotification:anything()]; }
This is correct and verification is success. But I need verify if my UILocalNotification object property alertBody is in withoutFriends array. Is there a way for this ?
There is a matcher isIn
which I see is missing from the README. Together with the hasProperty
matcher, we can write:
[verifyCount(application, times(1)) scheduleLocalNotification:hasProperty(@"alertBody", isIn(withoutFriends))];