Code example for MockContext

        testSignature = "test123";
        mResolver = new MockContentResolver();
        final String filenamePrefix = "test.";
        RenamingDelegatingContext targetContextWrapper = new RenamingDelegatingContext(
                new MockContext(), // The context that most methods are
                // delegated to 
                getContext(), // The context that file methods are delegated to
        mProviderContext = new MyIsolatedContext(mResolver, targetContextWrapper);
        mProvider = mProviderClass.newInstance();
        mProvider.attachInfo(mProviderContext, null);
        mResolver.addProvider(mProviderAuthority, getProvider());
    public MockContentResolver getMockContentResolver() {
        return mResolver;
Connect your IDE to all the code out there  Get Codota for Java