From 54616f3435e67029006d2f77462c61ed0635a3f6 Mon Sep 17 00:00:00 2001 From: Daisuke Miyakawa Date: Thu, 15 Oct 2009 14:57:55 -0700 Subject: [PATCH] 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 --- api/current.xml | 667 ++++++++++++++++++ .../android/test/mock}/MockCursor.java | 12 +- .../unit_tests/vcard/VCardExporterTests.java | 2 +- 3 files changed, 679 insertions(+), 2 deletions(-) rename {tests/AndroidTests/src/com/android/unit_tests/vcard => test-runner/android/test/mock}/MockCursor.java (96%) diff --git a/api/current.xml b/api/current.xml index 290bd8037501e..99436bdb38d6f 100644 --- a/api/current.xml +++ b/api/current.xml @@ -131845,6 +131845,673 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + * A mock {@link android.database.Cursor} class that isolates the test code from real + * Cursor implementation. + *

+ *

+ * All methods including ones related to querying the state of the cursor are + * are non-functional and throw {@link java.lang.UnsupportedOperationException}. + *

+ */ public class MockCursor implements Cursor { public int getColumnCount() { throw new UnsupportedOperationException("unimplemented mock method"); diff --git a/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardExporterTests.java b/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardExporterTests.java index 976474f785255..53afb5b83a395 100644 --- a/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardExporterTests.java +++ b/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardExporterTests.java @@ -58,7 +58,7 @@ import android.provider.ContactsContract.CommonDataKinds.Website; import android.test.AndroidTestCase; import android.test.mock.MockContentResolver; import android.test.mock.MockContext; -import android.util.Log; +import android.test.mock.MockCursor; import java.io.ByteArrayInputStream; import java.io.IOException;