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