Add eachItem method in order to be able to validate each emission
ppgsalomao opened this issue · 0 comments
ppgsalomao commented
Description
As a i want to be able to validate each emission from my Observable in a clean way, such as the other methods of this library.
Acceptance Criteria
- Add a eachItem() method that receives a custom matcher and validates each object emitted by the Observable against that matcher.
Example
@Test
public void multipleEmisstion_AreMatchedOnCondition() {
List<String> expected = Arrays.asList("These", "are", "Expected", "Values");
Observable<String> values = Observable.from(expected);
Condition<String> notNullAndNotEmpty =
new Condition<String>() {
@Override
public boolean matches(String value) {
return value != null && !value.isEmpty();
}
};
RxAssertions.assertThat(values)
.completes()
.eachItemMatches(notNullAndNotEmpty);
}