Top Description Constructors Methods
org.assertj.core.api

public Class AtomicReferenceFieldUpdaterAssert<FIELD, OBJECT>

extends AbstractAtomicFieldUpdaterAssert<AtomicReferenceFieldUpdaterAssert<FIELD, OBJECT>, FIELD, AtomicReferenceFieldUpdater<OBJECT, FIELD>, OBJECT>
Class Inheritance
Type Parameters
<FIELD>
the type of the field which gets updated by the AtomicReferenceFieldUpdater.
<OBJECT>
the type of the object holding the updatable field.
Imports
java.util.concurrent.atomic.AtomicReferenceFieldUpdater

Assertion methods for AtomicReferenceFieldUpdaters.

To create an instance of this class, invoke Assertions#assertThat(AtomicReferenceFieldUpdater).

Author
epeee
Since
2.7.0 / 3.7.0

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected FIELD
public AtomicReferenceFieldUpdaterAssert<FIELD, OBJECT>

Returns:

this assertion object.
hasValue
(FIELD
the expected value inside the OBJECT.
expectedValue
,
OBJECT
the object holding the updatable field.
obj
)

Overrides org.assertj.core.api.AbstractAtomicFieldUpdaterAssert.hasValue.

Verifies that the actual atomic field updater contains the given value at the given object.
Inherited from org.assertj.core.api.AbstractAtomicFieldUpdaterAssert:
validate

Constructor Detail

AtomicReferenceFieldUpdaterAssertback to summary
public AtomicReferenceFieldUpdaterAssert(AtomicReferenceFieldUpdater<OBJECT, FIELD> actual)

Method Detail

getActualValueback to summary
protected FIELD getActualValue(OBJECT obj)

Implements abstract org.assertj.core.api.AbstractAtomicFieldUpdaterAssert.getActualValue.

Annotations
@Override
hasValueback to summary
public AtomicReferenceFieldUpdaterAssert<FIELD, OBJECT> hasValue(FIELD expectedValue, OBJECT obj)

Overrides org.assertj.core.api.AbstractAtomicFieldUpdaterAssert.hasValue.

Verifies that the actual atomic field updater contains the given value at the given object.

Example:

 // person is an instance of a Person class holding a non-private volatile String field (name).
AtomicReferenceFieldUpdater<Person,String> fieldUpdater 
      = AtomicReferenceFieldUpdater.newUpdater(Person.class, String.class, "name");

// this assertion succeeds:
ageUpdater.set(person, "Superman");
assertThat(ageUpdater).hasValue("Superman", person);

// this assertion fails:
fieldUpdater.set(person, "Batman");
assertThat(fieldUpdater).hasValue("Superman", person);
Parameters
expectedValue:FIELD

the expected value inside the OBJECT.

obj:OBJECT

the object holding the updatable field.

Returns:AtomicReferenceFieldUpdaterAssert<FIELD, OBJECT>

this assertion object.

Annotations
@Override
Since
2.7.0 / 3.7.0