1 /*
2  * Copyright (C) 2009 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 
17 package android.test.mock;
18 
19 import android.content.ContentResolver;
20 import android.database.CharArrayBuffer;
21 import android.database.ContentObserver;
22 import android.database.Cursor;
23 import android.database.DataSetObserver;
24 import android.net.Uri;
25 import android.os.Bundle;
26 
27 /**
28  * <P>
29  * A mock {@link android.database.Cursor} class that isolates the test code from real
30  * Cursor implementation.
31  * </P>
32  * <P>
33  * All methods including ones related to querying the state of the cursor are
34  * are non-functional and throw {@link java.lang.UnsupportedOperationException}.
35  * </P>
36  */
37 public class MockCursor implements Cursor {
getColumnCount()38     public int getColumnCount() {
39         throw new UnsupportedOperationException("unimplemented mock method");
40     }
41 
getColumnIndex(String columnName)42     public int getColumnIndex(String columnName) {
43         throw new UnsupportedOperationException("unimplemented mock method");
44     }
45 
getColumnIndexOrThrow(String columnName)46     public int getColumnIndexOrThrow(String columnName) {
47         throw new UnsupportedOperationException("unimplemented mock method");
48     }
49 
getColumnName(int columnIndex)50     public String getColumnName(int columnIndex) {
51         throw new UnsupportedOperationException("unimplemented mock method");
52     }
53 
getColumnNames()54     public String[] getColumnNames() {
55         throw new UnsupportedOperationException("unimplemented mock method");
56     }
57 
getCount()58     public int getCount() {
59         throw new UnsupportedOperationException("unimplemented mock method");
60     }
61 
isNull(int columnIndex)62     public boolean isNull(int columnIndex) {
63         throw new UnsupportedOperationException("unimplemented mock method");
64     }
65 
getInt(int columnIndex)66     public int getInt(int columnIndex) {
67         throw new UnsupportedOperationException("unimplemented mock method");
68     }
69 
getLong(int columnIndex)70     public long getLong(int columnIndex) {
71         throw new UnsupportedOperationException("unimplemented mock method");
72     }
73 
getShort(int columnIndex)74     public short getShort(int columnIndex) {
75         throw new UnsupportedOperationException("unimplemented mock method");
76     }
77 
getFloat(int columnIndex)78     public float getFloat(int columnIndex) {
79         throw new UnsupportedOperationException("unimplemented mock method");
80     }
81 
getDouble(int columnIndex)82     public double getDouble(int columnIndex) {
83         throw new UnsupportedOperationException("unimplemented mock method");
84     }
85 
getBlob(int columnIndex)86     public byte[] getBlob(int columnIndex) {
87         throw new UnsupportedOperationException("unimplemented mock method");
88     }
89 
getString(int columnIndex)90     public String getString(int columnIndex) {
91         throw new UnsupportedOperationException("unimplemented mock method");
92     }
93 
getExtras()94     public Bundle getExtras() {
95         throw new UnsupportedOperationException("unimplemented mock method");
96     }
97 
getPosition()98     public int getPosition() {
99         throw new UnsupportedOperationException("unimplemented mock method");
100     }
101 
isAfterLast()102     public boolean isAfterLast() {
103         throw new UnsupportedOperationException("unimplemented mock method");
104     }
105 
isBeforeFirst()106     public boolean isBeforeFirst() {
107         throw new UnsupportedOperationException("unimplemented mock method");
108     }
109 
isFirst()110     public boolean isFirst() {
111         throw new UnsupportedOperationException("unimplemented mock method");
112     }
113 
isLast()114     public boolean isLast() {
115         throw new UnsupportedOperationException("unimplemented mock method");
116     }
117 
move(int offset)118     public boolean move(int offset) {
119         throw new UnsupportedOperationException("unimplemented mock method");
120     }
121 
moveToFirst()122     public boolean moveToFirst() {
123         throw new UnsupportedOperationException("unimplemented mock method");
124     }
125 
moveToLast()126     public boolean moveToLast() {
127         throw new UnsupportedOperationException("unimplemented mock method");
128     }
129 
moveToNext()130     public boolean moveToNext() {
131         throw new UnsupportedOperationException("unimplemented mock method");
132     }
133 
moveToPrevious()134     public boolean moveToPrevious() {
135         throw new UnsupportedOperationException("unimplemented mock method");
136     }
137 
moveToPosition(int position)138     public boolean moveToPosition(int position) {
139         throw new UnsupportedOperationException("unimplemented mock method");
140     }
141 
copyStringToBuffer(int columnIndex, CharArrayBuffer buffer)142     public void copyStringToBuffer(int columnIndex, CharArrayBuffer buffer) {
143         throw new UnsupportedOperationException("unimplemented mock method");
144     }
145 
deactivate()146     public void deactivate() {
147         throw new UnsupportedOperationException("unimplemented mock method");
148     }
149 
close()150     public void close() {
151         throw new UnsupportedOperationException("unimplemented mock method");
152     }
153 
isClosed()154     public boolean isClosed() {
155         throw new UnsupportedOperationException("unimplemented mock method");
156     }
157 
requery()158     public boolean requery() {
159         throw new UnsupportedOperationException("unimplemented mock method");
160     }
161 
registerContentObserver(ContentObserver observer)162     public void registerContentObserver(ContentObserver observer) {
163         throw new UnsupportedOperationException("unimplemented mock method");
164     }
165 
registerDataSetObserver(DataSetObserver observer)166     public void registerDataSetObserver(DataSetObserver observer) {
167         throw new UnsupportedOperationException("unimplemented mock method");
168     }
169 
respond(Bundle extras)170     public Bundle respond(Bundle extras) {
171         throw new UnsupportedOperationException("unimplemented mock method");
172     }
173 
getWantsAllOnMoveCalls()174     public boolean getWantsAllOnMoveCalls() {
175         throw new UnsupportedOperationException("unimplemented mock method");
176     }
177 
setNotificationUri(ContentResolver cr, Uri uri)178     public void setNotificationUri(ContentResolver cr, Uri uri) {
179         throw new UnsupportedOperationException("unimplemented mock method");
180     }
181 
getNotificationUri()182     public Uri getNotificationUri() {
183         throw new UnsupportedOperationException("unimplemented mock method");
184     }
185 
unregisterContentObserver(ContentObserver observer)186     public void unregisterContentObserver(ContentObserver observer) {
187         throw new UnsupportedOperationException("unimplemented mock method");
188     }
189 
unregisterDataSetObserver(DataSetObserver observer)190     public void unregisterDataSetObserver(DataSetObserver observer) {
191         throw new UnsupportedOperationException("unimplemented mock method");
192     }
193 
getType(int columnIndex)194     public int getType(int columnIndex) {
195         throw new UnsupportedOperationException("unimplemented mock method");
196     }
197 }