From f2cec58d90381c05033f26add5693252e68f48f9 Mon Sep 17 00:00:00 2001 From: Bjorn Bringert Date: Wed, 22 Jul 2009 20:40:04 +0100 Subject: Handle null in MatrixCursor.get*() Before, if a column contained null, MatrixCursor.getString() returned the string "null", and the get() methods threw exceptions. Now, getString() returns null, and get() return 0. Fixes http://b/issue?id=1996628 --- tests/CoreTests/android/database/MatrixCursorTest.java | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests/CoreTests') 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() { -- cgit v1.1