I'm trying to setup unit tests inside Android Studio (which supposedly is still 'experimental'). How do I get a Context
? All the examples I see call AndroidTestCase.getContext()
but in my tests this returns null.
public class DummyTest extends AndroidTestCase {
public void testExample() throws Exception {
Context c = getContext();
assertNotNull(c);
}
}
This will result in a AssertionFailedError
because the returned context is null.