blob: 9c00ecf9116aaba5b91a1e80e93da120f2cd3cfb [file] [log] [blame]
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001/*
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;
21import android.content.ISyncAdapter;
22import android.database.Cursor;
23import android.database.CursorWindow;
24import android.database.IBulkCursor;
25import android.database.IContentObserver;
26import android.net.Uri;
27import android.os.RemoteException;
28import android.os.IBinder;
29import android.os.ParcelFileDescriptor;
30
31import java.io.FileNotFoundException;
32
33/**
34 * Mock implementation of IContentProvider that does nothing. All methods are non-functional and
35 * throw {@link java.lang.UnsupportedOperationException}. Tests can extend this class to
36 * implement behavior needed for tests.
37 *
38 * @hide - Because IContentProvider hides bulkQuery(), this doesn't pass through JavaDoc
39 * without generating errors.
40 *
41 */
42public class MockContentProvider implements IContentProvider {
43
44 @SuppressWarnings("unused")
45 public int bulkInsert(Uri url, ContentValues[] initialValues) throws RemoteException {
46 // TODO Auto-generated method stub
47 return 0;
48 }
49
50 @SuppressWarnings("unused")
51 public IBulkCursor bulkQuery(Uri url, String[] projection, String selection,
52 String[] selectionArgs, String sortOrder, IContentObserver observer,
53 CursorWindow window) throws RemoteException {
54 throw new UnsupportedOperationException("unimplemented mock method");
55 }
56
57 @SuppressWarnings("unused")
58 public int delete(Uri url, String selection, String[] selectionArgs)
59 throws RemoteException {
60 throw new UnsupportedOperationException("unimplemented mock method");
61 }
62
63 @SuppressWarnings("unused")
64 public ISyncAdapter getSyncAdapter() throws RemoteException {
65 throw new UnsupportedOperationException("unimplemented mock method");
66 }
67
68 @SuppressWarnings("unused")
69 public String getType(Uri url) throws RemoteException {
70 throw new UnsupportedOperationException("unimplemented mock method");
71 }
72
73 @SuppressWarnings("unused")
74 public Uri insert(Uri url, ContentValues initialValues) throws RemoteException {
75 throw new UnsupportedOperationException("unimplemented mock method");
76 }
77
78 @SuppressWarnings("unused")
79 public ParcelFileDescriptor openFile(Uri url, String mode) throws RemoteException,
80 FileNotFoundException {
81 throw new UnsupportedOperationException("unimplemented mock method");
82 }
83
84 @SuppressWarnings("unused")
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -070085 public Cursor query(Uri url, String[] projection, String selection, String[] selectionArgs,
86 String sortOrder) throws RemoteException {
87 throw new UnsupportedOperationException("unimplemented mock method");
88 }
89
90 @SuppressWarnings("unused")
91 public int update(Uri url, ContentValues values, String selection, String[] selectionArgs)
92 throws RemoteException {
93 throw new UnsupportedOperationException("unimplemented mock method");
94 }
95
96 public IBinder asBinder() {
97 throw new UnsupportedOperationException("unimplemented mock method");
98 }
99
100}