本文整理汇总了Java中org.robolectric.shadows.ShadowContentResolver.query方法的典型用法代码示例。如果您正苦于以下问题:Java ShadowContentResolver.query方法的具体用法?Java ShadowContentResolver.query怎么用?Java ShadowContentResolver.query使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.robolectric.shadows.ShadowContentResolver
的用法示例。
在下文中一共展示了ShadowContentResolver.query方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: assertIsInstalledVersionInDb
import org.robolectric.shadows.ShadowContentResolver; //导入方法依赖的package包/类
public static void assertIsInstalledVersionInDb(ShadowContentResolver resolver,
String appId, int versionCode, String versionName) {
Uri uri = InstalledAppProvider.getAppUri(appId);
String[] projection = {
InstalledAppTable.Cols.Package.NAME,
InstalledAppTable.Cols.VERSION_CODE,
InstalledAppTable.Cols.VERSION_NAME,
InstalledAppTable.Cols.APPLICATION_LABEL,
};
Cursor cursor = resolver.query(uri, projection, null, null, null);
assertNotNull(cursor);
assertEquals("App \"" + appId + "\" not installed", 1, cursor.getCount());
cursor.moveToFirst();
assertEquals(appId, cursor.getString(cursor.getColumnIndex(InstalledAppTable.Cols.Package.NAME)));
assertEquals(versionCode, cursor.getInt(cursor.getColumnIndex(InstalledAppTable.Cols.VERSION_CODE)));
assertEquals(versionName, cursor.getString(cursor.getColumnIndex(InstalledAppTable.Cols.VERSION_NAME)));
cursor.close();
}
示例2: assertInvalidUri
import org.robolectric.shadows.ShadowContentResolver; //导入方法依赖的package包/类
public static void assertInvalidUri(ShadowContentResolver resolver, Uri uri) {
Cursor cursor = resolver.query(uri, new String[]{}, null, null, null);
assertNull(cursor);
}
示例3: assertValidUri
import org.robolectric.shadows.ShadowContentResolver; //导入方法依赖的package包/类
public static void assertValidUri(ShadowContentResolver resolver, Uri uri, String[] projection) {
Cursor cursor = resolver.query(uri, projection, null, null, null);
assertNotNull(cursor);
cursor.close();
}
示例4: assertResultCount
import org.robolectric.shadows.ShadowContentResolver; //导入方法依赖的package包/类
public static void assertResultCount(ShadowContentResolver resolver, int expectedCount, Uri uri,
String[] projection) {
Cursor cursor = resolver.query(uri, projection, null, null, null);
assertResultCount(expectedCount, cursor);
cursor.close();
}