• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  * A mock {@link android.database.Cursor} class that isolates the test code from real
29  * Cursor implementation.
30  *
31  * <p>
32  * All methods including ones related to querying the state of the cursor are
33  * are non-functional and throw {@link java.lang.UnsupportedOperationException}.
34  *
35  * @deprecated Use a mocking framework like <a href="https://github.com/mockito/mockito">Mockito</a>.
36  * New tests should be written using the
37  * <a href="{@docRoot}tools/testing-support-library/index.html">Android Testing Support Library</a>.
38  */
39 @Deprecated
40 public class MockCursor implements Cursor {
41     @Override
getColumnCount()42     public int getColumnCount() {
43         throw new UnsupportedOperationException("unimplemented mock method");
44     }
45 
46     @Override
getColumnIndex(String columnName)47     public int getColumnIndex(String columnName) {
48         throw new UnsupportedOperationException("unimplemented mock method");
49     }
50 
51     @Override
getColumnIndexOrThrow(String columnName)52     public int getColumnIndexOrThrow(String columnName) {
53         throw new UnsupportedOperationException("unimplemented mock method");
54     }
55 
56     @Override
getColumnName(int columnIndex)57     public String getColumnName(int columnIndex) {
58         throw new UnsupportedOperationException("unimplemented mock method");
59     }
60 
61     @Override
getColumnNames()62     public String[] getColumnNames() {
63         throw new UnsupportedOperationException("unimplemented mock method");
64     }
65 
66     @Override
getCount()67     public int getCount() {
68         throw new UnsupportedOperationException("unimplemented mock method");
69     }
70 
71     @Override
isNull(int columnIndex)72     public boolean isNull(int columnIndex) {
73         throw new UnsupportedOperationException("unimplemented mock method");
74     }
75 
76     @Override
getInt(int columnIndex)77     public int getInt(int columnIndex) {
78         throw new UnsupportedOperationException("unimplemented mock method");
79     }
80 
81     @Override
getLong(int columnIndex)82     public long getLong(int columnIndex) {
83         throw new UnsupportedOperationException("unimplemented mock method");
84     }
85 
86     @Override
getShort(int columnIndex)87     public short getShort(int columnIndex) {
88         throw new UnsupportedOperationException("unimplemented mock method");
89     }
90 
91     @Override
getFloat(int columnIndex)92     public float getFloat(int columnIndex) {
93         throw new UnsupportedOperationException("unimplemented mock method");
94     }
95 
96     @Override
getDouble(int columnIndex)97     public double getDouble(int columnIndex) {
98         throw new UnsupportedOperationException("unimplemented mock method");
99     }
100 
101     @Override
getBlob(int columnIndex)102     public byte[] getBlob(int columnIndex) {
103         throw new UnsupportedOperationException("unimplemented mock method");
104     }
105 
106     @Override
getString(int columnIndex)107     public String getString(int columnIndex) {
108         throw new UnsupportedOperationException("unimplemented mock method");
109     }
110 
111     @Override
setExtras(Bundle extras)112     public void setExtras(Bundle extras) {
113         throw new UnsupportedOperationException("unimplemented mock method");
114     }
115 
116     @Override
getExtras()117     public Bundle getExtras() {
118         throw new UnsupportedOperationException("unimplemented mock method");
119     }
120 
121     @Override
getPosition()122     public int getPosition() {
123         throw new UnsupportedOperationException("unimplemented mock method");
124     }
125 
126     @Override
isAfterLast()127     public boolean isAfterLast() {
128         throw new UnsupportedOperationException("unimplemented mock method");
129     }
130 
131     @Override
isBeforeFirst()132     public boolean isBeforeFirst() {
133         throw new UnsupportedOperationException("unimplemented mock method");
134     }
135 
136     @Override
isFirst()137     public boolean isFirst() {
138         throw new UnsupportedOperationException("unimplemented mock method");
139     }
140 
141     @Override
isLast()142     public boolean isLast() {
143         throw new UnsupportedOperationException("unimplemented mock method");
144     }
145 
146     @Override
move(int offset)147     public boolean move(int offset) {
148         throw new UnsupportedOperationException("unimplemented mock method");
149     }
150 
151     @Override
moveToFirst()152     public boolean moveToFirst() {
153         throw new UnsupportedOperationException("unimplemented mock method");
154     }
155 
156     @Override
moveToLast()157     public boolean moveToLast() {
158         throw new UnsupportedOperationException("unimplemented mock method");
159     }
160 
161     @Override
moveToNext()162     public boolean moveToNext() {
163         throw new UnsupportedOperationException("unimplemented mock method");
164     }
165 
166     @Override
moveToPrevious()167     public boolean moveToPrevious() {
168         throw new UnsupportedOperationException("unimplemented mock method");
169     }
170 
171     @Override
moveToPosition(int position)172     public boolean moveToPosition(int position) {
173         throw new UnsupportedOperationException("unimplemented mock method");
174     }
175 
176     @Override
copyStringToBuffer(int columnIndex, CharArrayBuffer buffer)177     public void copyStringToBuffer(int columnIndex, CharArrayBuffer buffer) {
178         throw new UnsupportedOperationException("unimplemented mock method");
179     }
180 
181     @Override
182     @Deprecated
deactivate()183     public void deactivate() {
184         throw new UnsupportedOperationException("unimplemented mock method");
185     }
186 
187     @Override
close()188     public void close() {
189         throw new UnsupportedOperationException("unimplemented mock method");
190     }
191 
192     @Override
isClosed()193     public boolean isClosed() {
194         throw new UnsupportedOperationException("unimplemented mock method");
195     }
196 
197     @Override
198     @Deprecated
requery()199     public boolean requery() {
200         throw new UnsupportedOperationException("unimplemented mock method");
201     }
202 
203     @Override
registerContentObserver(ContentObserver observer)204     public void registerContentObserver(ContentObserver observer) {
205         throw new UnsupportedOperationException("unimplemented mock method");
206     }
207 
208     @Override
registerDataSetObserver(DataSetObserver observer)209     public void registerDataSetObserver(DataSetObserver observer) {
210         throw new UnsupportedOperationException("unimplemented mock method");
211     }
212 
213     @Override
respond(Bundle extras)214     public Bundle respond(Bundle extras) {
215         throw new UnsupportedOperationException("unimplemented mock method");
216     }
217 
218     @Override
getWantsAllOnMoveCalls()219     public boolean getWantsAllOnMoveCalls() {
220         throw new UnsupportedOperationException("unimplemented mock method");
221     }
222 
223     @Override
setNotificationUri(ContentResolver cr, Uri uri)224     public void setNotificationUri(ContentResolver cr, Uri uri) {
225         throw new UnsupportedOperationException("unimplemented mock method");
226     }
227 
228     @Override
getNotificationUri()229     public Uri getNotificationUri() {
230         throw new UnsupportedOperationException("unimplemented mock method");
231     }
232 
233     @Override
unregisterContentObserver(ContentObserver observer)234     public void unregisterContentObserver(ContentObserver observer) {
235         throw new UnsupportedOperationException("unimplemented mock method");
236     }
237 
238     @Override
unregisterDataSetObserver(DataSetObserver observer)239     public void unregisterDataSetObserver(DataSetObserver observer) {
240         throw new UnsupportedOperationException("unimplemented mock method");
241     }
242 
243     @Override
getType(int columnIndex)244     public int getType(int columnIndex) {
245         throw new UnsupportedOperationException("unimplemented mock method");
246     }
247 }