We're trying to create a unit test (with OCMock although, open to other frameworks) that mocks a class that on class load has a side effect.
We have a tracking class that wraps calls to other tracking libraries like Flurry.
Many of these other tracking libraries (specifically, Flurry) execute code on class initialization.
The unit test fails as the code can't execute in a unit test environment. Ideally, we would like to replace the Flurry class with a mock/stub.
- (void) testConstruction {
[Flurry class];
}
When this code is called it attempts to use SCNetworkReachability
and receives exceptions
...
How can we stub/mock out calls to Flurry that has a static implementation like the following?
[Flurry setAppVersion:@"1.0"];
[Flurry setCrashReportingEnabled:NO];