FileDocCategorySizeDatePackage
MockContentProvider.javaAPI DocAndroid 5.1 API9872Thu Mar 12 22:22:42 GMT 2015android.test.mock

MockContentProvider

public class MockContentProvider extends android.content.ContentProvider
Mock implementation of ContentProvider. All methods are non-functional and throw {@link java.lang.UnsupportedOperationException}. Tests can extend this class to implement behavior needed for tests.

Fields Summary
private final InversionIContentProvider
mIContentProvider
Constructors Summary
protected MockContentProvider()
A constructor using {@link MockContext} instance as a Context in it.


                    
      
        super(new MockContext(), "", "", null);
    
public MockContentProvider(android.content.Context context)
A constructor accepting a Context instance, which is supposed to be the subclasss of {@link MockContext}.

        super(context, "", "", null);
    
public MockContentProvider(android.content.Context context, String readPermission, String writePermission, android.content.pm.PathPermission[] pathPermissions)
A constructor which initialize four member variables which {@link android.content.ContentProvider} have internally.

param
context A Context object which should be some mock instance (like the instance of {@link android.test.mock.MockContext}).
param
readPermission The read permision you want this instance should have in the test, which is available via {@link #getReadPermission()}.
param
writePermission The write permission you want this instance should have in the test, which is available via {@link #getWritePermission()}.
param
pathPermissions The PathPermissions you want this instance should have in the test, which is available via {@link #getPathPermissions()}.

        super(context, readPermission, writePermission, pathPermissions);
    
Methods Summary
public android.content.ContentProviderResult[]applyBatch(java.util.ArrayList operations)

        throw new UnsupportedOperationException("unimplemented mock method");
    
public voidattachInfo(android.content.Context context, android.content.pm.ProviderInfo info)

        throw new UnsupportedOperationException("unimplemented mock method");
    
public intbulkInsert(android.net.Uri uri, android.content.ContentValues[] values)
If you're reluctant to implement this manually, please just call super.bulkInsert().

        throw new UnsupportedOperationException("unimplemented mock method");
    
public android.os.Bundlecall(java.lang.String method, java.lang.String request, android.os.Bundle args)

hide

        throw new UnsupportedOperationException("unimplemented mock method call");
    
public intdelete(android.net.Uri uri, java.lang.String selection, java.lang.String[] selectionArgs)

        throw new UnsupportedOperationException("unimplemented mock method");
    
public final android.content.IContentProvidergetIContentProvider()
Returns IContentProvider which calls back same methods in this class. By overriding this class, we avoid the mechanism hidden behind ContentProvider (IPC, etc.)

hide

        return mIContentProvider;
    
public java.lang.String[]getStreamTypes(android.net.Uri url, java.lang.String mimeTypeFilter)

        throw new UnsupportedOperationException("unimplemented mock method call");
    
public java.lang.StringgetType(android.net.Uri uri)

        throw new UnsupportedOperationException("unimplemented mock method");
    
public android.net.Uriinsert(android.net.Uri uri, android.content.ContentValues values)

        throw new UnsupportedOperationException("unimplemented mock method");
    
public booleanonCreate()

        throw new UnsupportedOperationException("unimplemented mock method");
    
public android.content.res.AssetFileDescriptoropenTypedAssetFile(android.net.Uri url, java.lang.String mimeType, android.os.Bundle opts)

        throw new UnsupportedOperationException("unimplemented mock method call");
    
public android.database.Cursorquery(android.net.Uri uri, java.lang.String[] projection, java.lang.String selection, java.lang.String[] selectionArgs, java.lang.String sortOrder)

        throw new UnsupportedOperationException("unimplemented mock method");
    
public intupdate(android.net.Uri uri, android.content.ContentValues values, java.lang.String selection, java.lang.String[] selectionArgs)

        throw new UnsupportedOperationException("unimplemented mock method");