Class AtomicLongFieldUpdaterAssert<OBJECT>

    • Constructor Detail

      • AtomicLongFieldUpdaterAssert

        public AtomicLongFieldUpdaterAssert​(java.util.concurrent.atomic.AtomicLongFieldUpdater<OBJECT> actual)
    • Method Detail

      • hasValue

        public AtomicLongFieldUpdaterAssert<OBJECT> hasValue​(java.lang.Long expectedValue,
                                                             OBJECT obj)
        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 long field (age).
         AtomicIntegerFieldUpdater<Person> ageUpdater = AtomicIntegerFieldUpdater.newUpdater(Person.class, "age");
         
         // this assertion succeeds:
         ageUpdater.set(person, 25);
         assertThat(ageUpdater).hasValue(25, person);
        
         // this assertion fails:
         fieldUpdater.set(person, 28);
         assertThat(fieldUpdater).hasValue(25, person);
        Overrides:
        hasValue in class AbstractAtomicFieldUpdaterAssert<AtomicLongFieldUpdaterAssert<OBJECT>,​java.lang.Long,​java.util.concurrent.atomic.AtomicLongFieldUpdater<OBJECT>,​OBJECT>
        Parameters:
        expectedValue - the expected value inside the OBJECT.
        obj - the object holding the updatable field.
        Returns:
        this assertion object.
        Since:
        2.7.0 / 3.7.0