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