Class AbstractOptionalIntAssert<SELF extends AbstractOptionalIntAssert<SELF>>

    • Field Detail

      • integers

        org.assertj.core.internal.Integers integers
    • Constructor Detail

      • AbstractOptionalIntAssert

        protected AbstractOptionalIntAssert​(OptionalInt actual,
                                            Class<?> selfType)
    • Method Detail

      • isPresent

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

        Assertion will pass :

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

        Assertion will fail :

         assertThat(OptionalInt.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 OptionalInt is empty (alias of isEmpty()).

        Assertion will pass :

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

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

        Assertion will pass :

         assertThat(OptionalInt.empty()).isEmpty();

        Assertion will fail :

         assertThat(OptionalInt.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 OptionalInt, it's an alias of isPresent().

        Assertion will pass :

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

        Assertion will fail :

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

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

        Assertion will pass :

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

        Assertion will fail :

         assertThat(OptionalInt.empty()).hasValue(8);
         assertThat(OptionalInt.of(7)).hasValue(8);
        Parameters:
        expectedValue - the expected value inside the OptionalInt.
        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.