I have some code in +initialize method of a class that I’d like to test (using simple OCUnit). Namely it’s application delegate that sets some user defaults, so my testing would look like this:
- Check for absence of values-to-be-set;
- Load a class;
- Check for presence and correctness of set values;
Do you have any hints on how can I achieve this?
Yup – You can move your defaults initialization implementation out to a separate function, which you call from
+[MONObject initialize].Test the function in a lower level suite which does not load the objc class (
MONObject) into the objc runtime.Then you can test it and destroy it in a separate executable, and rely on that proof in your app level test suite.