public class AtomicReferenceAssert<V> extends AbstractAssert<AtomicReferenceAssert<V>,AtomicReference<V>>
actual, info, myself, objects, throwUnsupportedExceptionOnEquals| Constructor and Description |
|---|
AtomicReferenceAssert(AtomicReference<V> actual) |
| Modifier and Type | Method and Description |
|---|---|
AtomicReferenceAssert<V> |
doesNotHaveValue(V nonExpectedValue)
Verifies that the atomic under test does not have the given value.
|
AtomicReferenceAssert<V> |
hasValue(V expectedValue)
Verifies that the atomic under test has the given value.
|
AtomicReferenceAssert<V> |
hasValueMatching(Predicate<? super V> predicate)
Verifies that the atomic under test has a value satisfying the given predicate.
|
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.
|
AtomicReferenceAssert<V> |
hasValueSatisfying(Consumer<? super V> requirements)
Verifies that the atomic under test has a value satisfying the given requirements.
|
areEqual, asInstanceOf, asList, assertionError, asString, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, doesNotHaveSameHashCodeAs, doesNotHaveToString, equals, extracting, extracting, failure, failureWithActualExpected, failWithActualExpectedAndMessage, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, inBinary, inHexadecimal, is, isElementOfCustomAssert, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isInstanceOfSatisfying, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, matches, matches, newListAssertInstance, overridingErrorMessage, overridingErrorMessage, satisfies, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, satisfiesAnyOfForProxy, satisfiesForProxy, setCustomRepresentation, setDescriptionConsumer, setPrintAssertionsDescription, throwAssertionError, usingComparator, usingComparator, usingDefaultComparator, usingRecursiveComparison, usingRecursiveComparison, withFailMessage, withFailMessage, withRepresentation, withThreadDumpOnErrorclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitas, as, as, describedAspublic AtomicReferenceAssert(AtomicReference<V> actual)
public AtomicReferenceAssert<V> hasValue(V expectedValue)
Example:
// assertion succeeds
assertThat(new AtomicReference("foo")).hasValue("foo");
// assertion fails
assertThat(new AtomicReference("foo")).hasValue("bar");expectedValue - the expected value.this assertion object.AssertionError - if the atomic under test is null.AssertionError - if the atomic under test does not have the given value.public AtomicReferenceAssert<V> doesNotHaveValue(V nonExpectedValue)
Example:
// assertion succeeds
assertThat(new AtomicReference("foo")).doesNotHaveValue("bar");
// assertion fails
assertThat(new AtomicReference("foo")).doesNotHaveValue("foo");nonExpectedValue - the value not expected.this assertion object.AssertionError - if the atomic under test is null.AssertionError - if the atomic under test has the given value.public AtomicReferenceAssert<V> hasValueMatching(Predicate<? super V> predicate)
Example:
// assertion succeeds
assertThat(new AtomicReference("foo")).hasValueMatching(result -> result != null);
// assertion fails
assertThat(new AtomicReference("foo")).hasValueMatching(result -> result == null); predicate - the Predicate to apply on the resulting value.this assertion object.NullPointerException - if the given Predicate is nullAssertionError - if the atomic under test is null.AssertionError - if the atomic under test value does not matches with the given predicate.public AtomicReferenceAssert<V> hasValueMatching(Predicate<? super V> predicate, String description)
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");
predicate - the Predicate to apply on the resulting value.description - the Predicate description.this assertion object.NullPointerException - if the given Predicate is nullAssertionError - if the atomic under test is null.AssertionError - if the atomic under test value does not matches with the given predicate.public AtomicReferenceAssert<V> hasValueSatisfying(Consumer<? super V> requirements)
Example:
// assertion succeeds
assertThat(new AtomicReference("foo")).hasValueSatisfying(result -> assertThat(result).isNotBlank());
// assertion fails
assertThat(new AtomicReference("foo")).hasValueSatisfying(result -> assertThat(result).isBlank()); requirements - to assert on the actual object - must not be null.NullPointerException - if the given Consumer is nullAssertionError - if the atomic under test is null.AssertionError - if the atomic under test value does not satisfies with the given requirements.Copyright © 2025. All rights reserved.