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;
Stop searching for code, let great code find you!  Add Codota to your java IDE