/** {@inheritDoc} */ @Override public SELF is(Condition<? super ACTUAL> condition) { conditions.assertIs(info, actual, condition); return myself; }
/** {@inheritDoc} */ @Override public SELF is(Condition<? super ACTUAL> condition) { conditions.assertIs(info, actual, condition); return myself; }
/** * Verifies that the actual {@link Optional} contains a value which satisfies the given {@link Condition}. * <p> * Examples: * <pre><code class='java'> Condition<TolkienCharacter> isAnElf = new Condition<>(character -> character.getRace() == ELF, "an elf"); * * TolkienCharacter legolas = new TolkienCharacter("Legolas", 1000, ELF); * TolkienCharacter frodo = new TolkienCharacter("Frodo", 33, HOBBIT); * * // assertion succeeds * assertThat(Optional.of(legolas)).hasValueSatisfying(isAnElf); * * // assertion fails * assertThat(Optional.of(frodo)).hasValueSatisfying(isAnElf);</code></pre> * * @param condition the given condition. * @return this assertion object. * @throws AssertionError if the actual {@link Optional} is null or empty. * @throws NullPointerException if the given condition is {@code null}. * @throws AssertionError if the actual value does not satisfy the given condition. * @since 3.6.0 */ public SELF hasValueSatisfying(Condition<? super VALUE> condition) { assertValueIsPresent(); conditions.assertIs(info, actual.get(), condition); return myself; }
/** * Verifies that the actual {@link Optional} contains a value which satisfies the given {@link Condition}. * <p> * Examples: * <pre><code class='java'> Condition<TolkienCharacter> isAnElf = new Condition<>(character -> character.getRace() == ELF, "an elf"); * * TolkienCharacter legolas = new TolkienCharacter("Legolas", 1000, ELF); * TolkienCharacter frodo = new TolkienCharacter("Frodo", 33, HOBBIT); * * // assertion succeeds * assertThat(Optional.of(legolas)).hasValueSatisfying(isAnElf); * * // assertion fails * assertThat(Optional.of(frodo)).hasValueSatisfying(isAnElf);</code></pre> * * @param condition the given condition. * @return this assertion object. * @throws AssertionError if the actual {@link Optional} is null or empty. * @throws NullPointerException if the given condition is {@code null}. * @throws AssertionError if the actual value does not satisfy the given condition. * @since 3.6.0 */ public SELF hasValueSatisfying(Condition<? super VALUE> condition) { assertValueIsPresent(); conditions.assertIs(info, actual.get(), condition); return myself; }
/** {@inheritDoc} */ @Override public S is(Condition<? super A> condition) { conditions.assertIs(info, actual, condition); return myself; }
/** * Verifies that the actual {@link Option} contains a value which satisfies the given {@link Condition}. * * @param condition the given condition. * @return this assertion object. * @throws AssertionError if the actual {@link Option} is null or empty. * @throws NullPointerException if the given condition is {@code null}. * @throws AssertionError if the actual value does not satisfy the given condition. */ public SELF hasValueSatisfying(Condition<? super VALUE> condition) { assertValueIsPresent(); conditions.assertIs(info, actual.get(), condition); return myself; }
/** * Verifies that the actual {@link Try} contains a value which satisfies the given {@link Condition}. * * @param condition the given condition. * @return this assertion object. * @throws AssertionError if the actual {@link Try} is null or empty. * @throws NullPointerException if the given condition is {@code null}. * @throws AssertionError if the actual value does not satisfy the given condition. */ public SELF hasValueSatisfying(Condition<? super VALUE> condition) { assertIsSuccess(); conditions.assertIs(info, actual.get(), condition); return myself; }