use of org.assertj.core.api.iterable.ThrowingExtractor in project assertj-core by joel-costigliola.
the class AtomicReferenceArrayAssert_flatExtracting_Test method should_allow_assertions_on_joined_lists_when_extracting_children_with_anonymous_class_throwing_extractor.
@Test
public void should_allow_assertions_on_joined_lists_when_extracting_children_with_anonymous_class_throwing_extractor() {
AtomicReferenceArray<CartoonCharacter> cartoonCharacters = new AtomicReferenceArray<>(array(homer, fred));
assertThat(cartoonCharacters).flatExtracting(new ThrowingExtractor<CartoonCharacter, List<CartoonCharacter>, Exception>() {
@Override
public List<CartoonCharacter> extractThrows(CartoonCharacter cartoonCharacter) throws Exception {
if (cartoonCharacter.getChildren().isEmpty())
throw new Exception("no children");
return cartoonCharacter.getChildren();
}
}).containsOnly(bart, lisa, maggie, pebbles);
}
use of org.assertj.core.api.iterable.ThrowingExtractor in project assertj-core by joel-costigliola.
the class ObjectArrayAssert_flatExtracting_Test method should_allow_assertions_on_joined_lists_when_extracting_children_with_anonymous_class_throwing_extractor.
@Test
public void should_allow_assertions_on_joined_lists_when_extracting_children_with_anonymous_class_throwing_extractor() {
CartoonCharacter[] cartoonCharacters = array(homer, fred);
assertThat(cartoonCharacters).flatExtracting(new ThrowingExtractor<CartoonCharacter, List<CartoonCharacter>, Exception>() {
@Override
public List<CartoonCharacter> extractThrows(CartoonCharacter cartoonCharacter) throws Exception {
if (cartoonCharacter.getChildren().isEmpty())
throw new Exception("no children");
return cartoonCharacter.getChildren();
}
}).containsOnly(bart, lisa, maggie, pebbles);
}
Aggregations