iOS how to test a method that calls the [[UIApplication sharedApplication] openUrl:someUrl]

ios, objective-c, tdd

Solution

I deleted the new class with the static method and to solve my problem I used a partial mock from the Specta framework: `id mockApplication = [OCMockObject partialMockForObject:[UIApplication sharedApplication]];`

I guess this is a better solution. (I didn't know partial mocks before)

Problem

I want to create a test for the method bellow, I would like to check if the forgot password is right. I'm new on TDD and I would like to know if you guys think this is necessary and how could I implement the test. ``` - (IBAction)forgotPasswordButtonClicked:(id)sender { [[UIApplication sharedApplication] openURL:[NSURL URLWithString:kForgetPasswordURL]]; ``` } Thanks a lot

Original source