Class IntPredicateAssert

    • Constructor Detail

      • IntPredicateAssert

        public IntPredicateAssert​(IntPredicate actual)
    • Method Detail

      • 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.