Top Fields Constructors Methods
org.assertj.core.api

public Class AtomicReferenceAssert<V>

extends AbstractAssert<AtomicReferenceAssert<V>, AtomicReference<V>>
Class Inheritance
Static Imports
java.util.Objects.requireNonNull, org.assertj.core.error.ShouldHaveValue.shouldHaveValue, .ShouldMatch.shouldMatch, .ShouldNotContainValue.shouldNotContainValue

Field Summary

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

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public AtomicReferenceAssert<V>

Returns:

this assertion object.
doesNotHaveNullValue
()

Verifies that the atomic under test does not have the null value.

public AtomicReferenceAssert<V>

Returns:

this assertion object.
doesNotHaveValue
(V
the value not expected.
nonExpectedValue
)

Verifies that the atomic under test does not have the given value.

public AtomicReferenceAssert<V>

Returns:

this assertion object.
hasNullValue
()

Verifies that the atomic under test has the null value.

public AtomicReferenceAssert<V>

Returns:

this assertion object.
hasValue
(V
the expected value.
expectedValue
)

Verifies that the atomic under test has the given value.

public AtomicReferenceAssert<V>

Returns:

this assertion object.
hasValueMatching
(Predicate<? super V>
the Predicate to apply on the resulting value.
predicate
)

Verifies that the atomic under test has a value satisfying the given predicate.

public AtomicReferenceAssert<V>

Returns:

this assertion object.
hasValueMatching
(Predicate<? super V>
the Predicate to apply on the resulting value.
predicate
,
String
the Predicate description.
description
)

Verifies that the atomic under test has a value satisfying the given predicate, the string parameter is used in the error message to describe the predicate.

private AtomicReferenceAssert<V>
hasValueMatching(Predicate<? super V> predicate, PredicateDescription description)

public AtomicReferenceAssert<V>

Returns:

this assertion object.
hasValueSatisfying
(Consumer<? super V>
to assert on the actual object - must not be null.
requirements
)

Verifies that the atomic under test has a value satisfying the given requirements.

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

Constructor Detail

AtomicReferenceAssertback to summary
public AtomicReferenceAssert(AtomicReference<V> actual)

Method Detail

doesNotHaveNullValueback to summary
public AtomicReferenceAssert<V> doesNotHaveNullValue()

Verifies that the atomic under test does not have the null value.

Example:

 // assertion succeeds
assertThat(new AtomicReference("foo")).doesNotHaveNullValue();

// assertion fails
assertThat(new AtomicReference(null)).doesNotHaveNullValue();
Returns:AtomicReferenceAssert<V>

this assertion object.

Exceptions
AssertionError:
if the atomic under test has the null value.
Since
3.25.0
doesNotHaveValueback to summary
public AtomicReferenceAssert<V> doesNotHaveValue(V nonExpectedValue)

Verifies that the atomic under test does not have the given value.

Example:

 // assertion succeeds
assertThat(new AtomicReference("foo")).doesNotHaveValue("bar");

// assertion fails
assertThat(new AtomicReference("foo")).doesNotHaveValue("foo");
Parameters
nonExpectedValue:V

the value not expected.

Returns:AtomicReferenceAssert<V>

this assertion object.

Exceptions
AssertionError:
  • if the atomic under test is null.
  • if the atomic under test has the given value.
Since
2.7.0 / 3.7.0
hasNullValueback to summary
public AtomicReferenceAssert<V> hasNullValue()

Verifies that the atomic under test has the null value.

Example:

 // assertion succeeds
assertThat(new AtomicReference(null)).hasNullValue();

// assertion fails
assertThat(new AtomicReference("foo")).hasNullValue();
Returns:AtomicReferenceAssert<V>

this assertion object.

Exceptions
AssertionError:
if the atomic under test does not have the null value.
Since
3.25.0
hasValueback to summary
public AtomicReferenceAssert<V> hasValue(V expectedValue)

Verifies that the atomic under test has the given value.

Example:

 // assertion succeeds
assertThat(new AtomicReference("foo")).hasValue("foo");

// assertion fails
assertThat(new AtomicReference("foo")).hasValue("bar");
Parameters
expectedValue:V

the expected value.

Returns:AtomicReferenceAssert<V>

this assertion object.

Exceptions
AssertionError:
  • if the atomic under test is null.
  • if the atomic under test does not have the given value.
Since
2.7.0 / 3.7.0
hasValueMatchingback to summary
public AtomicReferenceAssert<V> hasValueMatching(Predicate<? super V> predicate)

Verifies that the atomic under test has a value satisfying the given predicate.

Example:

 // assertion succeeds
assertThat(new AtomicReference("foo")).hasValueMatching(result -> result != null);

// assertion fails
assertThat(new AtomicReference("foo")).hasValueMatching(result -> result == null); 
Parameters
predicate:Predicate<? super V>

the Predicate to apply on the resulting value.

Returns:AtomicReferenceAssert<V>

this assertion object.

Exceptions
NullPointerException:
if the given Predicate is null
AssertionError:
  • if the atomic under test is null.
  • if the atomic under test value does not matches with the given predicate.
Since
3.18.0
hasValueMatchingback to summary
public AtomicReferenceAssert<V> hasValueMatching(Predicate<? super V> predicate, String description)

Verifies that the atomic under test has a value satisfying the given predicate, the string parameter is used in the error message to describe the predicate.

Example:

 // assertion succeeds
assertThat(new AtomicReference("foo")).hasValueMatching(result -> result != null, "expected not null");

// assertion fails
assertThat(new AtomicReference("foo")).hasValueMatching(result -> result == null, "expected null");
Parameters
predicate:Predicate<? super V>

the Predicate to apply on the resulting value.

description:String

the Predicate description.

Returns:AtomicReferenceAssert<V>

this assertion object.

Exceptions
NullPointerException:
if the given Predicate is null
AssertionError:
  • if the atomic under test is null.
  • if the atomic under test value does not matches with the given predicate.
Since
3.18.0
hasValueMatchingback to summary
private AtomicReferenceAssert<V> hasValueMatching(Predicate<? super V> predicate, PredicateDescription description)
hasValueSatisfyingback to summary
public AtomicReferenceAssert<V> hasValueSatisfying(Consumer<? super V> requirements)

Verifies that the atomic under test has a value satisfying the given requirements.

Example:

 // assertion succeeds
assertThat(new AtomicReference("foo")).hasValueSatisfying(result -> assertThat(result).isNotBlank());

// assertion fails
assertThat(new AtomicReference("foo")).hasValueSatisfying(result -> assertThat(result).isBlank()); 
Parameters
requirements:Consumer<? super V>

to assert on the actual object - must not be null.

Returns:AtomicReferenceAssert<V>

this assertion object.

Exceptions
NullPointerException:
if the given Consumer is null
AssertionError:
  • if the atomic under test is null.
  • if the atomic under test value does not satisfies with the given requirements.
Since
3.18.0