tags:

views:

72

answers:

0

So I have a custom Application class which has global state in it custom to my application. Currently inside of my activityUnitTest the Application object does not seem to be instantiated and it causes a lot of underlying calls to fail. How do you go about telling the ActivityUnitTest to create an instance of my desired application Object.

I made a request to setApplication(Instrumentation.newApplication() which seems to do the creation on a different thread. So the Application object is constructed but the onCreate() method is not called yet by the time it reaches the rest of my code. Is there a known way of doing this? Currently I have a weird and funky wait of signaling the end of the creation but I have to block the rest of the test case until that happens using wait and notify or some custom locks.