I have something like
- (void)getData:(SomeParameter*)param
{
// Remotely call out for data returned asynchronously
// returns data via a delegate method
}
- (void)handleDataDelegateMethod:(NSData*)data
{
// Handle returned data
}
I want to write a unit test for this, how can I do something better than
NSData* returnedData = nil;
- (void)handleDataDelegateMethod:(NSData*)data
{
returnedData = data;
}
- (void)test
{
[obj getData:param];
while (!returnedData)
{
[NSThread sleep:1];
}
// Make tests on returnedData
}