title: Objective C - Unit testing & Mocking object?
body: <pre><code>- (BOOL)coolMethod:(NSString*)str
  {
       //do some stuff
       Webservice *ws = [[WebService alloc] init];
       NSString *result = [ws startSynchronous:url];
       if ([result isEqual:@"Something"])
       {
           //More calculation
           return YES;
       }
       return NO;
  }
  </code></pre>
  
  <p>I am using OCUnit
  In the following method how can i mock my WebService Object, or the result to the method "startSynchronous" to be able to write an independent unit test?</p>
  
  <p>Is it possible to inject some code in there to either create a mock web service or return a mock data on startSynchronous call?</p>