Class IntPredicateAssert

All Implemented Interfaces:
Assert<IntPredicateAssert,IntPredicate>, Descriptable<IntPredicateAssert>, ExtensionPoints<IntPredicateAssert,IntPredicate>

public class IntPredicateAssert extends AbstractPredicateLikeAssert<IntPredicateAssert,IntPredicate,Integer>
Assertions for Predicate.
Since:
3.5.0
  • Constructor Details

    • IntPredicateAssert

      public IntPredicateAssert(IntPredicate actual)
  • Method Details

    • assertThatIntPredicate

      public static IntPredicateAssert assertThatIntPredicate(IntPredicate actual)
    • toPredicate

      private static Predicate<Integer> toPredicate(IntPredicate actual)
    • accepts

      public IntPredicateAssert accepts(int... values)
      Verifies that IntPredicate evaluates all the given values to true.

      Example :

       IntPredicate evenNumber = n -> n % 2 == 0;
      
       // assertion succeeds:
       assertThat(evenNumber).accepts(2, 4, 6);
      
       // assertion fails because of 3:
       assertThat(evenNumber).accepts(2, 3, 4);
      Parameters:
      values - values that the actual Predicate should accept.
      Returns:
      this assertion object.
      Throws:
      AssertionError - if the actual Predicate does not accept all given values.
    • rejects

      public IntPredicateAssert rejects(int... values)
      Verifies that IntPredicate evaluates all the given values to false.

      Example :

       IntPredicate evenNumber = n -> n % 2 == 0;
      
       // assertion succeeds:
       assertThat(evenNumber).rejects(1, 3, 5);
      
       // assertion fails because of 2:
       assertThat(evenNumber).rejects(1, 2, 3);
      Parameters:
      values - values that the actual Predicate should reject.
      Returns:
      this assertion object.
      Throws:
      AssertionError - if the actual Predicate accepts one of the given values.