Query using MockContentResolver leads to NullPointerException
问题 We have a JUnit test class which extends ActivityInstrumentationTestCase2<CommentActivity> . The test (and the class we're testing) use CommentContentProvider , which extends ContentProvider , to access the SQLite database, and we're getting a NullPointerException [full stack trace below] when running a query on the provider. We instantiate a MockContentResolver as shown: MockContentResolver mResolver; public void setUp() { super.setUp(); CommentContentProvider ccp = new