Java 类org.robolectric.fakes.RoboCursor 实例源码

项目:GitHub    文件:ThumbnailStreamOpenerTest.java   
@Test
public void testVideoQueryReturnsVideoCursor() {
  Uri queryUri = MediaStore.Video.Thumbnails.EXTERNAL_CONTENT_URI;
  ThumbFetcher.VideoThumbnailQuery query =
      new ThumbFetcher.VideoThumbnailQuery(getContentResolver());
  RoboCursor testCursor = new RoboCursor();
  Shadows.shadowOf(RuntimeEnvironment.application.getContentResolver())
      .setCursor(queryUri, testCursor);
  assertEquals(testCursor, query.query(harness.uri));
}
项目:GitHub    文件:ThumbnailStreamOpenerTest.java   
@Test
public void testImageQueryReturnsImageCursor() {
  Uri queryUri = MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI;
  ThumbFetcher.ImageThumbnailQuery query =
      new ThumbFetcher.ImageThumbnailQuery(getContentResolver());
  RoboCursor testCursor = new RoboCursor();
  Shadows.shadowOf(RuntimeEnvironment.application.getContentResolver())
      .setCursor(queryUri, testCursor);
  assertEquals(testCursor, query.query(harness.uri));
}
项目:GitHub    文件:ThumbnailStreamOpenerTest.java   
@Test
public void testVideoQueryReturnsVideoCursor() {
  Uri queryUri = MediaStore.Video.Thumbnails.EXTERNAL_CONTENT_URI;
  ThumbFetcher.VideoThumbnailQuery query =
      new ThumbFetcher.VideoThumbnailQuery(getContentResolver());
  RoboCursor testCursor = new RoboCursor();
  Shadows.shadowOf(RuntimeEnvironment.application.getContentResolver())
      .setCursor(queryUri, testCursor);
  assertEquals(testCursor, query.query(harness.uri));
}
项目:GitHub    文件:ThumbnailStreamOpenerTest.java   
@Test
public void testImageQueryReturnsImageCursor() {
  Uri queryUri = MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI;
  ThumbFetcher.ImageThumbnailQuery query =
      new ThumbFetcher.ImageThumbnailQuery(getContentResolver());
  RoboCursor testCursor = new RoboCursor();
  Shadows.shadowOf(RuntimeEnvironment.application.getContentResolver())
      .setCursor(queryUri, testCursor);
  assertEquals(testCursor, query.query(harness.uri));
}
项目:AluShare    文件:ContactManagmentTest.java   
@Before
public void setUp(){
    TestHelper.resetHelperFactory();
    DummyDataSet.initSelf(context);
    RoboCursor cursor = new RoboCursor();
    String[] projection = new String[]{ContactsContract.RawContacts._ID};
    String selection = ContactsContract.RawContacts.CONTACT_ID + "=?";
    String[] selectionArgs = new String[]{};
    ContentValues values = new ContentValues();
    values.put(ContactsContract.Data.RAW_CONTACT_ID, 001);
    values.put(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE);
    values.put(ContactsContract.CommonDataKinds.Phone.NUMBER, "1-800-GOOG-411");
    values.put(ContactsContract.CommonDataKinds.Phone.TYPE, ContactsContract.CommonDataKinds.Phone.TYPE_CUSTOM);
    values.put(ContactsContract.CommonDataKinds.Phone.LABEL, "Test");
    dataUri = context.getContentResolver().insert(android.provider.ContactsContract.Data.CONTENT_URI, values);;
    helper = HelperFactory.getContacHelper(context);
    //context.getContentResolver().insert(ContactsContract.Contacts.CONTENT_URI,);
   /* cursor.setQuery(ContactsContract.Contacts.CONTENT_URI,projection,selection,selectionArgs,null);
    if(cursor.moveToFirst()) {
        lookUpKey = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY));
        Uri lookupUri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_LOOKUP_URI, this.lookUpKey);
        res = ContactsContract.Contacts.lookupContact(context.getContentResolver(), lookupUri);
        contactManagement = new ContactManagement(context, res, torId);
    }*/


}