diff options
author | Bjorn Bringert <bringert@android.com> | 2009-07-22 20:40:04 +0100 |
---|---|---|
committer | Bjorn Bringert <bringert@android.com> | 2009-07-22 21:20:51 +0100 |
commit | f2cec58d90381c05033f26add5693252e68f48f9 (patch) | |
tree | 9d76c9174a618e2c5437a4d7abd8150464725799 /tests/CoreTests | |
parent | b551fb872be9b758c7793f56398d25a74d4a404c (diff) | |
download | frameworks_base-f2cec58d90381c05033f26add5693252e68f48f9.zip frameworks_base-f2cec58d90381c05033f26add5693252e68f48f9.tar.gz frameworks_base-f2cec58d90381c05033f26add5693252e68f48f9.tar.bz2 |
Handle null in MatrixCursor.get*()
Before, if a column contained null, MatrixCursor.getString()
returned the string "null", and the get<Number>() methods
threw exceptions.
Now, getString() returns null, and get<Number>() return 0.
Fixes http://b/issue?id=1996628
Diffstat (limited to 'tests/CoreTests')
-rw-r--r-- | tests/CoreTests/android/database/MatrixCursorTest.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/CoreTests/android/database/MatrixCursorTest.java b/tests/CoreTests/android/database/MatrixCursorTest.java index fb8a12f..cddc6c4 100644 --- a/tests/CoreTests/android/database/MatrixCursorTest.java +++ b/tests/CoreTests/android/database/MatrixCursorTest.java @@ -32,6 +32,12 @@ public class MatrixCursorTest extends TestCase { cursor.newRow().add(null); cursor.moveToNext(); assertTrue(cursor.isNull(0)); + assertNull(cursor.getString(0)); + assertEquals(0, cursor.getShort(0)); + assertEquals(0, cursor.getInt(0)); + assertEquals(0L, cursor.getLong(0)); + assertEquals(0.0f, cursor.getFloat(0)); + assertEquals(0.0d, cursor.getDouble(0)); } public void testMatrixCursor() { |