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