use of java.util.function.Predicate in project assertj-core by joel-costigliola.
the class LongPredicateAssert_accepts_Test method should_pass_when_predicate_accepts_all_values.
@Test
public void should_pass_when_predicate_accepts_all_values() {
LongPredicate predicate = val -> val <= 2;
assertThat(predicate).accepts(1L, 2L);
}
use of java.util.function.Predicate in project assertj-core by joel-costigliola.
the class LongPredicateAssert_accepts_Test method should_fail_when_predicate_does_not_accept_value_with_string_description.
@Test
public void should_fail_when_predicate_does_not_accept_value_with_string_description() {
LongPredicate predicate = val -> val <= 2;
Predicate<Long> wrapPredicate = predicate::test;
long expectedValue = 3;
thrown.expectAssertionError("[test] " + shouldAccept(wrapPredicate, expectedValue, PredicateDescription.GIVEN).create());
assertThat(predicate).as("test").accepts(expectedValue);
}
use of java.util.function.Predicate in project assertj-core by joel-costigliola.
the class LongPredicateAssert_accepts_Test method should_fail_when_predicate_does_not_accept_value.
@Test
public void should_fail_when_predicate_does_not_accept_value() {
LongPredicate predicate = val -> val <= 2;
Predicate<Long> wrapPredicate = predicate::test;
long expectedValue = 3;
thrown.expectAssertionError(shouldAccept(wrapPredicate, expectedValue, PredicateDescription.GIVEN).create());
assertThat(predicate).accepts(expectedValue);
}
use of java.util.function.Predicate in project assertj-core by joel-costigliola.
the class LongPredicateAssert_accepts_Test method should_fail_when_predicate_does_not_accept_values.
@Test
public void should_fail_when_predicate_does_not_accept_values() {
LongPredicate predicate = val -> val <= 2;
long[] matchValues = new long[] { 1L, 2L, 3L };
thrown.expectAssertionError(elementsShouldMatch(matchValues, 3L, PredicateDescription.GIVEN).create());
assertThat(predicate).accepts(matchValues);
}
use of java.util.function.Predicate in project assertj-core by joel-costigliola.
the class LongPredicateAssert_rejects_Test method should_fail_when_predicate_accepts_value.
@Test
public void should_fail_when_predicate_accepts_value() {
LongPredicate predicate = val -> val <= 2;
Predicate<Long> wrapPredicate = predicate::test;
long expectedValue = 2;
thrown.expectAssertionError(shouldNotAccept(wrapPredicate, expectedValue, PredicateDescription.GIVEN).create());
assertThat(predicate).rejects(expectedValue);
}
Aggregations