blob: fdba2e27dfec2d3ee0c2cc37f733d3f06ad627cd [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2008 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.test.mock;
18
19import android.content.ContentValues;
20import android.content.IContentProvider;
Fred Quintana6a8d5332f2009-05-07 17:35:38 -070021import android.content.Entity;
22import android.content.EntityIterator;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080023import android.content.res.AssetFileDescriptor;
24import android.database.Cursor;
25import android.database.CursorWindow;
26import android.database.IBulkCursor;
27import android.database.IContentObserver;
28import android.net.Uri;
29import android.os.RemoteException;
30import android.os.IBinder;
31import android.os.ParcelFileDescriptor;
32
33import java.io.FileNotFoundException;
34
35/**
36 * Mock implementation of IContentProvider that does nothing. All methods are non-functional and
37 * throw {@link java.lang.UnsupportedOperationException}. Tests can extend this class to
38 * implement behavior needed for tests.
39 *
40 * @hide - Because IContentProvider hides bulkQuery(), this doesn't pass through JavaDoc
41 * without generating errors.
42 *
43 */
44public class MockContentProvider implements IContentProvider {
45
46 @SuppressWarnings("unused")
47 public int bulkInsert(Uri url, ContentValues[] initialValues) throws RemoteException {
48 // TODO Auto-generated method stub
49 return 0;
50 }
51
Fred Quintana6a8d5332f2009-05-07 17:35:38 -070052 public Uri[] bulkInsertEntities(Uri uri, Entity[] entities) throws RemoteException {
53 throw new UnsupportedOperationException("unimplemented mock method");
54 }
55
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080056 @SuppressWarnings("unused")
57 public IBulkCursor bulkQuery(Uri url, String[] projection, String selection,
58 String[] selectionArgs, String sortOrder, IContentObserver observer,
59 CursorWindow window) throws RemoteException {
60 throw new UnsupportedOperationException("unimplemented mock method");
61 }
62
63 @SuppressWarnings("unused")
64 public int delete(Uri url, String selection, String[] selectionArgs)
65 throws RemoteException {
66 throw new UnsupportedOperationException("unimplemented mock method");
67 }
68
69 @SuppressWarnings("unused")
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080070 public String getType(Uri url) throws RemoteException {
71 throw new UnsupportedOperationException("unimplemented mock method");
72 }
73
74 @SuppressWarnings("unused")
75 public Uri insert(Uri url, ContentValues initialValues) throws RemoteException {
76 throw new UnsupportedOperationException("unimplemented mock method");
77 }
78
79 @SuppressWarnings("unused")
80 public ParcelFileDescriptor openFile(Uri url, String mode) throws RemoteException,
81 FileNotFoundException {
82 throw new UnsupportedOperationException("unimplemented mock method");
83 }
84
85 @SuppressWarnings("unused")
86 public AssetFileDescriptor openAssetFile(Uri uri, String mode)
87 throws FileNotFoundException {
88 throw new UnsupportedOperationException("unimplemented mock method");
89 }
90
91 @SuppressWarnings("unused")
92 public Cursor query(Uri url, String[] projection, String selection, String[] selectionArgs,
93 String sortOrder) throws RemoteException {
94 throw new UnsupportedOperationException("unimplemented mock method");
95 }
96
Fred Quintana6a8d5332f2009-05-07 17:35:38 -070097 public EntityIterator queryEntities(Uri url, String selection, String[] selectionArgs,
98 String sortOrder) throws RemoteException {
99 throw new UnsupportedOperationException("unimplemented mock method");
100 }
101
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800102 @SuppressWarnings("unused")
103 public int update(Uri url, ContentValues values, String selection, String[] selectionArgs)
104 throws RemoteException {
105 throw new UnsupportedOperationException("unimplemented mock method");
106 }
107
Fred Quintana6a8d5332f2009-05-07 17:35:38 -0700108 public int[] bulkUpdateEntities(Uri uri, Entity[] entities) throws RemoteException {
109 throw new UnsupportedOperationException("unimplemented mock method");
110 }
111
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800112 public IBinder asBinder() {
113 throw new UnsupportedOperationException("unimplemented mock method");
114 }
115
116}