I am creating a function which uses intent to capture the image.It is working fine. How can I write unit test for that using Roboeletric framework?
void captureImage() {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
fileUri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);
startActivityForResult(intent, CAMERA_CAPTURE_IMAGE_REQUEST_CODE);
}
I created a test which is attached below. But, neither it is using Roboeletric nor it seems a good unit testing example.
public void testCaptureImage() {
Intent intent = new Intent();
intent.setType("image/*");
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
intent.setAction(Intent.ACTION_GET_CONTENT);
assertEquals(true, intent.getExtras().get(Intent.EXTRA_ALLOW_MULTIPLE));
}
Aucun commentaire:
Enregistrer un commentaire