You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have a special case not covered by the given assertions API, we encourage you to assert these special cases with our custom assertions API. It's a convenient way to replace plain `Matcher`s with complex assertions. With Barista, you can match any kind of view by knowing its type and passing its `viewId`, `text`, or a `Matcher<View>`. Once you matched it, you will be able to assert all its properties without adding any complex `Matcher` to your project.
@@ -355,10 +365,17 @@ assertAny<RadioGroup>(R.id.radioGroup, "selected option is the second one") {
355
365
}
356
366
```
357
367
358
-
## Barista’s Intents API
368
+
## Mocking the Intent results
369
+
370
+
Mocking the Android Camera Intent is a tricky thing to do. To accomplish it in no time, Barista gives a way to do it in one line: the method `mockAndroidCamera()`. This method does all the magic to mock the result of the camera. One more thing to do: you have to call `Intents.init()` before calling `mockAndroidCamera()`, and `Intents.release()` after doing the action that launches the camera. You could also use `IntentsTestRule` instead of the common `ActivityTestRule` to skip it, but as we recommend the use of `BaristaRule`, it's easier to just call both methods manually when needed.
371
+
372
+
Here's an example to copy paste:
373
+
359
374
```java
360
-
// Creates a Bitmap on a camera provided URI
375
+
Intents.init();
361
376
mockAndroidCamera();
377
+
clickOn(R.id.launch_camera);
378
+
Intents.release();
362
379
```
363
380
364
381
## Runtime Permissions
@@ -367,6 +384,9 @@ The new Marshmallow permissions system requires checking for permissions at runt
0 commit comments