/** * Verifies that the actual object matches the given predicate. * <p> * Example : * * <pre><code class='java'> assertThat(player).matches(p -> p.isRookie());</code></pre> * * @param predicate the {@link Predicate} to match * @return {@code this} assertion object. * @throws AssertionError if the actual does not match the given {@link Predicate}. * @throws NullPointerException if given {@link Predicate} is null. */ public SELF matches(Predicate<? super ACTUAL> predicate) { // use default PredicateDescription return matches(predicate, PredicateDescription.GIVEN); }
/** * Verifies that the actual object matches the given predicate. * <p> * Example : * * <pre><code class='java'> assertThat(player).matches(p -> p.isRookie());</code></pre> * * @param predicate the {@link Predicate} to match * @return {@code this} assertion object. * @throws AssertionError if the actual does not match the given {@link Predicate}. * @throws NullPointerException if given {@link Predicate} is null. */ public SELF matches(Predicate<? super ACTUAL> predicate) { // use default PredicateDescription return matches(predicate, PredicateDescription.GIVEN); }
/** * Verifies that the actual object matches the given predicate, the predicate description is used to get an * informative error message. * <p> * Example : * * <pre><code class='java'> assertThat(player).matches(p -> p.isRookie(), "is rookie");</code></pre> * * The error message contains the predicate description, if the previous assertion fails, it will be: * * <pre><code class='java'> Expecting: * <player> * to match 'is rookie' predicate.</code></pre> * * @param predicate the {@link Predicate} to match * @param predicateDescription a description of the {@link Predicate} used in the error message * @return {@code this} assertion object. * @throws AssertionError if the actual does not match the given {@link Predicate}. * @throws NullPointerException if given {@link Predicate} is null. * @throws NullPointerException if given predicateDescription is null. */ public SELF matches(Predicate<? super ACTUAL> predicate, String predicateDescription) { return matches(predicate, new PredicateDescription(predicateDescription)); }
/** * Verifies that the actual object matches the given predicate, the predicate description is used to get an * informative error message. * <p> * Example : * * <pre><code class='java'> assertThat(player).matches(p -> p.isRookie(), "is rookie");</code></pre> * * The error message contains the predicate description, if the previous assertion fails, it will be: * * <pre><code class='java'> Expecting: * <player> * to match 'is rookie' predicate.</code></pre> * * @param predicate the {@link Predicate} to match * @param predicateDescription a description of the {@link Predicate} used in the error message * @return {@code this} assertion object. * @throws AssertionError if the actual does not match the given {@link Predicate}. * @throws NullPointerException if given {@link Predicate} is null. * @throws NullPointerException if given predicateDescription is null. */ public SELF matches(Predicate<? super ACTUAL> predicate, String predicateDescription) { return matches(predicate, new PredicateDescription(predicateDescription)); }
/** * Verifies that the actual object matches the given predicate. * <p> * Example : * * <pre><code class='java'> * assertThat(player).matches(p -> p.isRookie()); * </code></pre> * * @param predicate the {@link Predicate} to match * @return {@code this} assertion object. * @throws AssertionError if the actual does not match the given {@link Predicate}. * @throws NullPointerException if given {@link Predicate} is null. */ public S matches(Predicate<? super A> predicate) { // use default PredicateDescription return matches(predicate, PredicateDescription.GIVEN); }
/** * Verifies that the actual object matches the given predicate, the predicate description is used to get an * informative error message. * <p> * Example : * * <pre><code class='java'> * assertThat(player).matches(p -> p.isRookie(), "is rookie"); * </code></pre> * * The error message contains the predicate description, if the previous assertion fails, it will be: * * <pre><code class='java'> * Expecting: * <player> * to match 'is rookie' predicate. * </code></pre> * * @param predicate the {@link Predicate} to match * @param predicateDescription a description of the {@link Predicate} used in the error message * @return {@code this} assertion object. * @throws AssertionError if the actual does not match the given {@link Predicate}. * @throws NullPointerException if given {@link Predicate} is null. * @throws NullPointerException if given predicateDescription is null. */ public S matches(Predicate<? super A> predicate, String predicateDescription) { return matches(predicate, new PredicateDescription(predicateDescription)); }