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