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