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 { 38 @Override getColumnCount()39 public int getColumnCount() { 40 throw new UnsupportedOperationException("unimplemented mock method"); 41 } 42 43 @Override getColumnIndex(String columnName)44 public int getColumnIndex(String columnName) { 45 throw new UnsupportedOperationException("unimplemented mock method"); 46 } 47 48 @Override getColumnIndexOrThrow(String columnName)49 public int getColumnIndexOrThrow(String columnName) { 50 throw new UnsupportedOperationException("unimplemented mock method"); 51 } 52 53 @Override getColumnName(int columnIndex)54 public String getColumnName(int columnIndex) { 55 throw new UnsupportedOperationException("unimplemented mock method"); 56 } 57 58 @Override getColumnNames()59 public String[] getColumnNames() { 60 throw new UnsupportedOperationException("unimplemented mock method"); 61 } 62 63 @Override getCount()64 public int getCount() { 65 throw new UnsupportedOperationException("unimplemented mock method"); 66 } 67 68 @Override isNull(int columnIndex)69 public boolean isNull(int columnIndex) { 70 throw new UnsupportedOperationException("unimplemented mock method"); 71 } 72 73 @Override getInt(int columnIndex)74 public int getInt(int columnIndex) { 75 throw new UnsupportedOperationException("unimplemented mock method"); 76 } 77 78 @Override getLong(int columnIndex)79 public long getLong(int columnIndex) { 80 throw new UnsupportedOperationException("unimplemented mock method"); 81 } 82 83 @Override getShort(int columnIndex)84 public short getShort(int columnIndex) { 85 throw new UnsupportedOperationException("unimplemented mock method"); 86 } 87 88 @Override getFloat(int columnIndex)89 public float getFloat(int columnIndex) { 90 throw new UnsupportedOperationException("unimplemented mock method"); 91 } 92 93 @Override getDouble(int columnIndex)94 public double getDouble(int columnIndex) { 95 throw new UnsupportedOperationException("unimplemented mock method"); 96 } 97 98 @Override getBlob(int columnIndex)99 public byte[] getBlob(int columnIndex) { 100 throw new UnsupportedOperationException("unimplemented mock method"); 101 } 102 103 @Override getString(int columnIndex)104 public String getString(int columnIndex) { 105 throw new UnsupportedOperationException("unimplemented mock method"); 106 } 107 108 @Override setExtras(Bundle extras)109 public void setExtras(Bundle extras) { 110 throw new UnsupportedOperationException("unimplemented mock method"); 111 } 112 113 @Override getExtras()114 public Bundle getExtras() { 115 throw new UnsupportedOperationException("unimplemented mock method"); 116 } 117 118 @Override getPosition()119 public int getPosition() { 120 throw new UnsupportedOperationException("unimplemented mock method"); 121 } 122 123 @Override isAfterLast()124 public boolean isAfterLast() { 125 throw new UnsupportedOperationException("unimplemented mock method"); 126 } 127 128 @Override isBeforeFirst()129 public boolean isBeforeFirst() { 130 throw new UnsupportedOperationException("unimplemented mock method"); 131 } 132 133 @Override isFirst()134 public boolean isFirst() { 135 throw new UnsupportedOperationException("unimplemented mock method"); 136 } 137 138 @Override isLast()139 public boolean isLast() { 140 throw new UnsupportedOperationException("unimplemented mock method"); 141 } 142 143 @Override move(int offset)144 public boolean move(int offset) { 145 throw new UnsupportedOperationException("unimplemented mock method"); 146 } 147 148 @Override moveToFirst()149 public boolean moveToFirst() { 150 throw new UnsupportedOperationException("unimplemented mock method"); 151 } 152 153 @Override moveToLast()154 public boolean moveToLast() { 155 throw new UnsupportedOperationException("unimplemented mock method"); 156 } 157 158 @Override moveToNext()159 public boolean moveToNext() { 160 throw new UnsupportedOperationException("unimplemented mock method"); 161 } 162 163 @Override moveToPrevious()164 public boolean moveToPrevious() { 165 throw new UnsupportedOperationException("unimplemented mock method"); 166 } 167 168 @Override moveToPosition(int position)169 public boolean moveToPosition(int position) { 170 throw new UnsupportedOperationException("unimplemented mock method"); 171 } 172 173 @Override copyStringToBuffer(int columnIndex, CharArrayBuffer buffer)174 public void copyStringToBuffer(int columnIndex, CharArrayBuffer buffer) { 175 throw new UnsupportedOperationException("unimplemented mock method"); 176 } 177 178 @Override 179 @Deprecated deactivate()180 public void deactivate() { 181 throw new UnsupportedOperationException("unimplemented mock method"); 182 } 183 184 @Override close()185 public void close() { 186 throw new UnsupportedOperationException("unimplemented mock method"); 187 } 188 189 @Override isClosed()190 public boolean isClosed() { 191 throw new UnsupportedOperationException("unimplemented mock method"); 192 } 193 194 @Override 195 @Deprecated requery()196 public boolean requery() { 197 throw new UnsupportedOperationException("unimplemented mock method"); 198 } 199 200 @Override registerContentObserver(ContentObserver observer)201 public void registerContentObserver(ContentObserver observer) { 202 throw new UnsupportedOperationException("unimplemented mock method"); 203 } 204 205 @Override registerDataSetObserver(DataSetObserver observer)206 public void registerDataSetObserver(DataSetObserver observer) { 207 throw new UnsupportedOperationException("unimplemented mock method"); 208 } 209 210 @Override respond(Bundle extras)211 public Bundle respond(Bundle extras) { 212 throw new UnsupportedOperationException("unimplemented mock method"); 213 } 214 215 @Override getWantsAllOnMoveCalls()216 public boolean getWantsAllOnMoveCalls() { 217 throw new UnsupportedOperationException("unimplemented mock method"); 218 } 219 220 @Override setNotificationUri(ContentResolver cr, Uri uri)221 public void setNotificationUri(ContentResolver cr, Uri uri) { 222 throw new UnsupportedOperationException("unimplemented mock method"); 223 } 224 225 @Override getNotificationUri()226 public Uri getNotificationUri() { 227 throw new UnsupportedOperationException("unimplemented mock method"); 228 } 229 230 @Override unregisterContentObserver(ContentObserver observer)231 public void unregisterContentObserver(ContentObserver observer) { 232 throw new UnsupportedOperationException("unimplemented mock method"); 233 } 234 235 @Override unregisterDataSetObserver(DataSetObserver observer)236 public void unregisterDataSetObserver(DataSetObserver observer) { 237 throw new UnsupportedOperationException("unimplemented mock method"); 238 } 239 240 @Override getType(int columnIndex)241 public int getType(int columnIndex) { 242 throw new UnsupportedOperationException("unimplemented mock method"); 243 } 244 }