私のコードを参照してください:
doSomeActionWillStartNewIntentToSelectImage();
// check started intent
Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.INTERNAL_CONTENT_URI);
Assert.assertThat(activity, new StartedMatcher(intent));
// simulate the returning result
shadowOf(activity).receiveResult(
new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.INTERNAL_CONTENT_URI),
Activity.RESULT_OK,
new Intent().setData(activity.drawableId2Uri(R.drawable.icon_ok)));
しかし、それはエラーを報告します:
java.lang.RuntimeException: No intent matches
Intent{action=android.intent.action.PICK, data=content://media/internal/images/media} among
[Intent{action=android.intent.action.PICK, data=content://media/internal/images/media}]
at com.xtremelabs.robolectric.shadows.ShadowActivity.receiveResult(ShadowActivity.java:381)
Intent{action=android.intent.action.PICK, data=content://media/internal/images/media}
後の方と全く同じで不思議です。
どこが間違っていて、それを修正する方法は?