Upvote:2

Aprove answer
MKTArgumentCaptor *argument = [[MKTArgumentCaptor alloc] init];
[verify(sut.userDefaults) setObject:[argument capture] forKey:@"example"];

Credit Goes to: stackoverflow.com

Related question with same questions but different answers