use of org.cactoos.iterable.IterableOfInts in project cactoos by yegor256.
the class FirstOfTest method returnsMatchingValueWithExceptionalFallback.
@Test
void returnsMatchingValueWithExceptionalFallback() {
final int value = 2;
new Assertion<>("Exception was not thrown", new FirstOf<>(i -> i >= value, new IterableOfInts(0, value), () -> {
throw new IllegalArgumentException("This exception should not be thrown");
}), new HasValue<>(value)).affirm();
}
use of org.cactoos.iterable.IterableOfInts in project cactoos by yegor256.
the class FirstOfTest method returnsMatchingValue.
@Test
void returnsMatchingValue() {
final int value = 1;
new Assertion<>("Must return the only matching element", new FirstOf<>(i -> i >= value, new IterableOfInts(0, value), () -> -1), new HasValue<>(value)).affirm();
}
Aggregations