diff --git a/src/androidTest/java/com/owncloud/android/datamodel/ContentResolverHelperTest.kt b/src/androidTest/java/com/owncloud/android/datamodel/ContentResolverHelperTest.kt index 03f9c866ac..2bb86cd710 100644 --- a/src/androidTest/java/com/owncloud/android/datamodel/ContentResolverHelperTest.kt +++ b/src/androidTest/java/com/owncloud/android/datamodel/ContentResolverHelperTest.kt @@ -28,6 +28,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SdkSuppress import io.mockk.mockk import io.mockk.verify +import org.junit.Assert.assertArrayEquals import org.junit.Assert.assertEquals import org.junit.Test import org.junit.runner.RunWith @@ -60,7 +61,10 @@ class ContentResolverHelperTest { withArg { bundle -> assertEquals(bundle.getString(ContentResolver.QUERY_ARG_SQL_SELECTION), SELECTION) assertEquals(bundle.getInt(ContentResolver.QUERY_ARG_LIMIT), LIMIT) - assertEquals(bundle.getString(ContentResolver.QUERY_ARG_SORT_COLUMNS), SORT_COLUMN) + assertArrayEquals( + bundle.getStringArray(ContentResolver.QUERY_ARG_SORT_COLUMNS), + arrayOf(SORT_COLUMN) + ) assertEquals(bundle.getInt(ContentResolver.QUERY_ARG_SORT_DIRECTION), SORT_DIRECTION_INT) }, null diff --git a/src/main/java/com/owncloud/android/datamodel/ContentResolverHelper.kt b/src/main/java/com/owncloud/android/datamodel/ContentResolverHelper.kt index df36508499..c2fd5c8dc6 100644 --- a/src/main/java/com/owncloud/android/datamodel/ContentResolverHelper.kt +++ b/src/main/java/com/owncloud/android/datamodel/ContentResolverHelper.kt @@ -98,7 +98,7 @@ object ContentResolverHelper { putString(ContentResolver.QUERY_ARG_SQL_SELECTION, selection) } if (sortColumn != null) { - putString(ContentResolver.QUERY_ARG_SORT_COLUMNS, sortColumn) + putStringArray(ContentResolver.QUERY_ARG_SORT_COLUMNS, arrayOf(sortColumn)) val direction = when (sortDirection) { SORT_DIRECTION_ASCENDING -> ContentResolver.QUERY_SORT_DIRECTION_ASCENDING else -> ContentResolver.QUERY_SORT_DIRECTION_DESCENDING