Class AbstractOptionalLongAssert<SELF extends AbstractOptionalLongAssert<SELF>>

  • All Implemented Interfaces:
    Assert<SELF,​java.util.OptionalLong>, Descriptable<SELF>, ExtensionPoints<SELF,​java.util.OptionalLong>
    Direct Known Subclasses:
    OptionalLongAssert

    public abstract class AbstractOptionalLongAssert<SELF extends AbstractOptionalLongAssert<SELF>>
    extends AbstractAssert<SELF,​java.util.OptionalLong>
    Assertions for OptionalLong.
    • Constructor Detail

      • AbstractOptionalLongAssert

        protected AbstractOptionalLongAssert​(java.util.OptionalLong actual,
                                             java.lang.Class<?> selfType)
    • Method Detail

      • isPresent

        public SELF isPresent()
        Verifies that there is a value present in the actual OptionalLong.

        Assertion will pass :

         assertThat(OptionalLong.of(10)).isPresent();

        Assertion will fail :

         assertThat(OptionalLong.empty()).isPresent();
        Returns:
        this assertion object.
        Throws:
        java.lang.AssertionError - if actual value is empty.
        java.lang.AssertionError - if actual is null.
      • isNotPresent

        public SELF isNotPresent()
        Verifies that the actual OptionalLong is empty (alias of isEmpty()).

        Assertion will pass :
         assertThat(OptionalLong.empty()).isNotPresent();
        Assertion will fail :
         assertThat(OptionalLong.of(10)).isNotPresent();
        Returns:
        this assertion object.
      • isEmpty

        public SELF isEmpty()
        Verifies that the actual OptionalLong is empty.

        Assertion will pass :

         assertThat(OptionalLong.empty()).isEmpty();

        Assertion will fail :

         assertThat(OptionalLong.of(10)).isEmpty();
        Returns:
        this assertion object.
        Throws:
        java.lang.AssertionError - if actual value is present.
        java.lang.AssertionError - if actual is null.
      • isNotEmpty

        public SELF isNotEmpty()
        Verifies that there is a value present in the actual OptionalLong, it's an alias of isPresent().

        Assertion will pass :

         assertThat(OptionalLong.of(10)).isNotEmpty();

        Assertion will fail :

         assertThat(OptionalLong.empty()).isNotEmpty();
        Returns:
        this assertion object.
        Throws:
        java.lang.AssertionError - if actual value is empty.
        java.lang.AssertionError - if actual is null.
      • hasValue

        public SELF hasValue​(long expectedValue)
        Verifies that the actual OptionalLong has the value in argument.

        Assertion will pass :

         assertThat(OptionalLong.of(8)).hasValue(8);
         assertThat(OptionalLong.of(8)).hasValue(Integer.valueOf(8));

        Assertion will fail :

         assertThat(OptionalLong.empty()).hasValue(8);
         assertThat(OptionalLong.of(7)).hasValue(8);
        Parameters:
        expectedValue - the expected value inside the OptionalLong.
        Returns:
        this assertion object.
        Throws:
        java.lang.AssertionError - if actual value is empty.
        java.lang.AssertionError - if actual is null.
        java.lang.AssertionError - if actual has not the value as expected.