@Test public void queryAlbumTest() { Uri uri = MediaContract.Albums.buildAlbumUri(hostInfo.getId(), TestValues.Album.albumId); Cursor cursor = contentResolver.query(uri, TestValues.Album.PROJECTION, null, null, null); assertNotNull(cursor); assertEquals("cursor size ", 1, cursor.getCount()); assertTrue(cursor.moveToFirst()); TestValues.Album.test(cursor); }
@Test public void queryAllAlbumsTest() { Uri uri = MediaContract.Albums.buildAlbumsListUri(hostInfo.getId()); Cursor cursor = contentResolver.query(uri, TestValues.Album.PROJECTION, null, null, null); assertNotNull(cursor); assertEquals("cursor size ", 232, cursor.getCount()); int columnIndex = cursor.getColumnIndex(MediaContract.AlbumsColumns.ALBUMID); TestUtils.testCursorContainsRange(cursor, columnIndex, 1, 75); TestUtils.testCursorContainsRange(cursor, columnIndex, 77, 82); TestUtils.testCursorContainsRange(cursor, columnIndex, 84, 234); }
@Test public void queryAlbumWithMultipleArtistsTest() { Uri uri = MediaContract.Albums.buildAlbumUri( hostInfo.getId(), TestValues.AlbumWithMultipleArtists.albumId); Cursor cursor = contentResolver.query( uri, TestValues.AlbumWithMultipleArtists.PROJECTION, null, null, null); assertNotNull(cursor); assertEquals("cursor size ", 1, cursor.getCount()); assertTrue(cursor.moveToFirst()); LogUtils.LOGD("MediaProviderMusicTest", Utils.cursorToString(cursor)); TestValues.AlbumWithMultipleArtists.test(cursor); }