Class AbstractOptionalLongAssert<SELF extends AbstractOptionalLongAssert<SELF>>

    • Constructor Detail

      • AbstractOptionalLongAssert

        protected AbstractOptionalLongAssert​(OptionalLong actual,
                                             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:
        AssertionError - if actual value is empty.
        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:
        AssertionError - if actual value is present.
        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:
        AssertionError - if actual value is empty.
        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:
        AssertionError - if actual value is empty.
        AssertionError - if actual is null.
        AssertionError - if actual has not the value as expected.