Top Description Fields Constructors Methods
org.assertj.core.api

public abstract Class AbstractOptionalLongAssert<SELF extends AbstractOptionalLongAssert<SELF>>

extends AbstractAssert<SELF extends AbstractOptionalLongAssert<SELF>, OptionalLong>
Class Inheritance
Known Direct Subclasses
org.assertj.core.api.OptionalLongAssert
Static Imports
org.assertj.core.error.OptionalShouldBeEmpty.shouldBeEmpty, .OptionalShouldBePresent.shouldBePresent, .OptionalShouldContain.shouldContain

Assertions for java.util.OptionalLong.
Authors
Jean-Christophe Gay, Alexander Bischof, Grzegorz Piwowarek

Field Summary

Inherited from org.assertj.core.api.AbstractAssert:
actualassertionErrorCreatorconditionscustomRepresentationinfomyselfobjectsprintAssertionsDescriptionthrowUnsupportedExceptionOnEquals

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public SELF

Returns:

this assertion object.
hasValue
(long
the expected value inside the java.util.OptionalLong.
expectedValue
)

Verifies that the actual java.util.OptionalLong has the value in argument.

public SELF

Returns:

this assertion object.
isEmpty
()

Verifies that the actual java.util.OptionalLong is empty.

public SELF

Returns:

this assertion object.
isNotEmpty
()

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

public SELF

Returns:

this assertion object.
isNotPresent
()

Verifies that the actual java.util.OptionalLong is empty (alias of isEmpty()).

public SELF

Returns:

this assertion object.
isPresent
()

Verifies that there is a value present in the actual java.util.OptionalLong.

Inherited from org.assertj.core.api.AbstractAssert:
areEqualasInstanceOfasListassertionErrorasStringdescribedAsdescriptionTextdoesNotHavedoesNotHaveSameClassAsdoesNotHaveSameHashCodeAsdoesNotHaveToStringdoesNotHaveToStringequalsextractingextractingfailurefailureWithActualExpectedfailWithActualExpectedAndMessagefailWithMessagegetWritableAssertionInfohashashCodehasSameClassAshasSameHashCodeAshasToStringhasToStringinBinaryinHexadecimalisisElementOfCustomAssertisEqualToisExactlyInstanceOfisInisInisInstanceOfisInstanceOfAnyisInstanceOfSatisfyingisNotisNotEqualToisNotExactlyInstanceOfisNotInisNotInisNotInstanceOfisNotInstanceOfAnyisNotNullisNotOfAnyClassInisNotSameAsisNullisOfAnyClassInisSameAsmatchesmatchesnewListAssertInstanceoverridingErrorMessageoverridingErrorMessagesatisfiessatisfiessatisfiessatisfiesAnyOfsatisfiesAnyOfsatisfiesAnyOfForProxysatisfiesForProxysetCustomRepresentationsetDescriptionConsumersetPrintAssertionsDescriptionthrowAssertionErrorusingComparatorusingComparatorusingDefaultComparatorusingRecursiveAssertionusingRecursiveAssertionusingRecursiveComparisonusingRecursiveComparisonwithAssertionStatewithFailMessagewithFailMessagewithRepresentationwithThreadDumpOnError

Constructor Detail

AbstractOptionalLongAssertback to summary
protected AbstractOptionalLongAssert(OptionalLong actual, Class<?> selfType)

Method Detail

hasValueback to summary
public SELF hasValue(long expectedValue)

Verifies that the actual java.util.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:long

the expected value inside the java.util.OptionalLong.

Returns:SELF

this assertion object.

Exceptions
AssertionError:
  • if actual value is empty.
  • if actual is null.
  • if actual has not the value as expected.
isEmptyback to summary
public SELF isEmpty()

Verifies that the actual java.util.OptionalLong is empty.

Assertion will pass :

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

Assertion will fail :

 assertThat(OptionalLong.of(10)).isEmpty();
Returns:SELF

this assertion object.

Exceptions
AssertionError:
  • if actual value is present.
  • if actual is null.
isNotEmptyback to summary
public SELF isNotEmpty()

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

Assertion will pass :

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

Assertion will fail :

 assertThat(OptionalLong.empty()).isNotEmpty();
Returns:SELF

this assertion object.

Exceptions
AssertionError:
  • if actual value is empty.
  • if actual is null.
isNotPresentback to summary
public SELF isNotPresent()

Verifies that the actual java.util.OptionalLong is empty (alias of isEmpty()).

Assertion will pass :

 assertThat(OptionalLong.empty()).isNotPresent();
Assertion will fail :
 assertThat(OptionalLong.of(10)).isNotPresent();
Returns:SELF

this assertion object.

isPresentback to summary
public SELF isPresent()

Verifies that there is a value present in the actual java.util.OptionalLong.

Assertion will pass :

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

Assertion will fail :

 assertThat(OptionalLong.empty()).isPresent();
Returns:SELF

this assertion object.

Exceptions
AssertionError:
  • if actual value is empty.
  • if actual is null.