Class AbstractOptionalLongAssert<SELF extends AbstractOptionalLongAssert<SELF>>

java.lang.Object
org.assertj.core.api.AbstractAssert<SELF,OptionalLong>
org.assertj.core.api.AbstractOptionalLongAssert<SELF>
All Implemented Interfaces:
Assert<SELF,OptionalLong>, Descriptable<SELF>, ExtensionPoints<SELF,OptionalLong>
Direct Known Subclasses:
OptionalLongAssert

public abstract class AbstractOptionalLongAssert<SELF extends AbstractOptionalLongAssert<SELF>> extends AbstractAssert<SELF,OptionalLong>
Assertions for OptionalLong.
Author:
Jean-Christophe Gay, Alexander Bischof, Grzegorz Piwowarek
  • Constructor Details

    • AbstractOptionalLongAssert

      protected AbstractOptionalLongAssert(OptionalLong actual, Class<?> selfType)
  • Method Details

    • 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.