Make MockCursor class a part of public SDK.

With this class, external developers will be able to reduce their
redundant work related to testing around ContentProvider/ContentResolver.

Internal Issue number: 2181010
This commit is contained in:
Daisuke Miyakawa
2009-10-15 14:57:55 -07:00
parent bfd5b38673
commit 54616f3435
3 changed files with 679 additions and 2 deletions

View File

@ -131845,6 +131845,673 @@
</parameter> </parameter>
</method> </method>
</class> </class>
<class name="MockCursor"
extends="java.lang.Object"
abstract="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<implements name="android.database.Cursor">
</implements>
<constructor name="MockCursor"
type="android.test.mock.MockCursor"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</constructor>
<method name="abortUpdates"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="close"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="commitUpdates"
return="boolean"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="commitUpdates"
return="boolean"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="values" type="java.util.Map&lt;? extends java.lang.Long, ? extends java.util.Map&lt;java.lang.String, java.lang.Object&gt;&gt;">
</parameter>
</method>
<method name="copyStringToBuffer"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="columnIndex" type="int">
</parameter>
<parameter name="buffer" type="android.database.CharArrayBuffer">
</parameter>
</method>
<method name="deactivate"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="deleteRow"
return="boolean"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="getBlob"
return="byte[]"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="columnIndex" type="int">
</parameter>
</method>
<method name="getColumnCount"
return="int"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="getColumnIndex"
return="int"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="columnName" type="java.lang.String">
</parameter>
</method>
<method name="getColumnIndexOrThrow"
return="int"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="columnName" type="java.lang.String">
</parameter>
</method>
<method name="getColumnName"
return="java.lang.String"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="columnIndex" type="int">
</parameter>
</method>
<method name="getColumnNames"
return="java.lang.String[]"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="getCount"
return="int"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="getDouble"
return="double"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="columnIndex" type="int">
</parameter>
</method>
<method name="getExtras"
return="android.os.Bundle"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="getFloat"
return="float"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="columnIndex" type="int">
</parameter>
</method>
<method name="getInt"
return="int"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="columnIndex" type="int">
</parameter>
</method>
<method name="getLong"
return="long"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="columnIndex" type="int">
</parameter>
</method>
<method name="getPosition"
return="int"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="getShort"
return="short"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="columnIndex" type="int">
</parameter>
</method>
<method name="getString"
return="java.lang.String"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="columnIndex" type="int">
</parameter>
</method>
<method name="getWantsAllOnMoveCalls"
return="boolean"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="hasUpdates"
return="boolean"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="isAfterLast"
return="boolean"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="isBeforeFirst"
return="boolean"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="isClosed"
return="boolean"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="isFirst"
return="boolean"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="isLast"
return="boolean"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="isNull"
return="boolean"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="columnIndex" type="int">
</parameter>
</method>
<method name="move"
return="boolean"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="offset" type="int">
</parameter>
</method>
<method name="moveToFirst"
return="boolean"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="moveToLast"
return="boolean"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="moveToNext"
return="boolean"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="moveToPosition"
return="boolean"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="position" type="int">
</parameter>
</method>
<method name="moveToPrevious"
return="boolean"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="registerContentObserver"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="observer" type="android.database.ContentObserver">
</parameter>
</method>
<method name="registerDataSetObserver"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="observer" type="android.database.DataSetObserver">
</parameter>
</method>
<method name="requery"
return="boolean"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="respond"
return="android.os.Bundle"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="extras" type="android.os.Bundle">
</parameter>
</method>
<method name="setNotificationUri"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="cr" type="android.content.ContentResolver">
</parameter>
<parameter name="uri" type="android.net.Uri">
</parameter>
</method>
<method name="supportsUpdates"
return="boolean"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="unregisterContentObserver"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="observer" type="android.database.ContentObserver">
</parameter>
</method>
<method name="unregisterDataSetObserver"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="observer" type="android.database.DataSetObserver">
</parameter>
</method>
<method name="updateBlob"
return="boolean"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="columnIndex" type="int">
</parameter>
<parameter name="value" type="byte[]">
</parameter>
</method>
<method name="updateDouble"
return="boolean"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="columnIndex" type="int">
</parameter>
<parameter name="value" type="double">
</parameter>
</method>
<method name="updateFloat"
return="boolean"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="columnIndex" type="int">
</parameter>
<parameter name="value" type="float">
</parameter>
</method>
<method name="updateInt"
return="boolean"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="columnIndex" type="int">
</parameter>
<parameter name="value" type="int">
</parameter>
</method>
<method name="updateLong"
return="boolean"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="columnIndex" type="int">
</parameter>
<parameter name="value" type="long">
</parameter>
</method>
<method name="updateShort"
return="boolean"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="columnIndex" type="int">
</parameter>
<parameter name="value" type="short">
</parameter>
</method>
<method name="updateString"
return="boolean"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="columnIndex" type="int">
</parameter>
<parameter name="value" type="java.lang.String">
</parameter>
</method>
<method name="updateToNull"
return="boolean"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="columnIndex" type="int">
</parameter>
</method>
</class>
<class name="MockDialogInterface" <class name="MockDialogInterface"
extends="java.lang.Object" extends="java.lang.Object"
abstract="false" abstract="false"

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.unit_tests.vcard; package android.test.mock;
import android.content.ContentResolver; import android.content.ContentResolver;
import android.database.CharArrayBuffer; import android.database.CharArrayBuffer;
@ -26,6 +26,16 @@ import android.os.Bundle;
import java.util.Map; import java.util.Map;
/**
* <P>
* A mock {@link android.database.Cursor} class that isolates the test code from real
* Cursor implementation.
* </P>
* <P>
* All methods including ones related to querying the state of the cursor are
* are non-functional and throw {@link java.lang.UnsupportedOperationException}.
* </P>
*/
public class MockCursor implements Cursor { public class MockCursor implements Cursor {
public int getColumnCount() { public int getColumnCount() {
throw new UnsupportedOperationException("unimplemented mock method"); throw new UnsupportedOperationException("unimplemented mock method");

View File

@ -58,7 +58,7 @@ import android.provider.ContactsContract.CommonDataKinds.Website;
import android.test.AndroidTestCase; import android.test.AndroidTestCase;
import android.test.mock.MockContentResolver; import android.test.mock.MockContentResolver;
import android.test.mock.MockContext; import android.test.mock.MockContext;
import android.util.Log; import android.test.mock.MockCursor;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.IOException; import java.io.IOException;