Package org.assertj.core.api
Class AtomicReferenceAssert<V>
java.lang.Object
org.assertj.core.api.AbstractAssert<AtomicReferenceAssert<V>,AtomicReference<V>>
org.assertj.core.api.AtomicReferenceAssert<V>
- All Implemented Interfaces:
Assert<AtomicReferenceAssert<V>,,AtomicReference<V>> Descriptable<AtomicReferenceAssert<V>>,ExtensionPoints<AtomicReferenceAssert<V>,AtomicReference<V>>
public class AtomicReferenceAssert<V>
extends AbstractAssert<AtomicReferenceAssert<V>,AtomicReference<V>>
-
Field Summary
Fields inherited from class org.assertj.core.api.AbstractAssert
actual, info, myself, objects, throwUnsupportedExceptionOnEquals -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionVerifies that the atomic under test does not have thenullvalue.doesNotHaveValue(V nonExpectedValue) Verifies that the atomic under test does not have the given value.Verifies that the atomic under test has thenullvalue.Verifies that the atomic under test has the given value.hasValueMatching(Predicate<? super V> predicate) Verifies that the atomic under test has a value satisfying the given predicate.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.hasValueSatisfying(Consumer<? super V> requirements) Verifies that the atomic under test has a value satisfying the given requirements.Methods inherited from class org.assertj.core.api.AbstractAssert
actual, areEqual, asInstanceOf, asList, assertionError, asString, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, doesNotHaveSameHashCodeAs, doesNotHaveToString, doesNotHaveToString, doesNotMatch, doesNotMatch, equals, extracting, extracting, failure, failureWithActualExpected, failWithActualExpectedAndMessage, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, 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, usingEquals, usingEquals, usingRecursiveAssertion, usingRecursiveAssertion, usingRecursiveComparison, usingRecursiveComparison, withFailMessage, withFailMessage, withRepresentation, withThreadDumpOnErrorMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.assertj.core.api.Descriptable
as, as, as, describedAs, describedAs
-
Constructor Details
-
AtomicReferenceAssert
-
-
Method Details
-
hasValue
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- the expected value.- Returns:
thisassertion object.- Throws:
AssertionError- if the atomic under test isnull.AssertionError- if the atomic under test does not have the given value.- Since:
- 2.7.0 / 3.7.0
-
doesNotHaveValue
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- the value not expected.- Returns:
thisassertion object.- Throws:
AssertionError- if the atomic under test isnull.AssertionError- if the atomic under test has the given value.- Since:
- 2.7.0 / 3.7.0
-
hasValueMatching
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- thePredicateto apply on the resulting value.- Returns:
thisassertion object.- Throws:
NullPointerException- if the givenPredicateis nullAssertionError- if the atomic under test isnull.AssertionError- if the atomic under test value does not matches with the given predicate.- Since:
- 3.18.0
-
hasValueMatching
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- thePredicateto apply on the resulting value.description- thePredicatedescription.- Returns:
thisassertion object.- Throws:
NullPointerException- if the givenPredicateis nullAssertionError- if the atomic under test isnull.AssertionError- if the atomic under test value does not matches with the given predicate.- Since:
- 3.18.0
-
hasValueSatisfying
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- to assert on the actual object - must not be null.- Returns:
- this assertion object.
- Throws:
NullPointerException- if the givenConsumeris nullAssertionError- if the atomic under test isnull.AssertionError- if the atomic under test value does not satisfies with the given requirements.- Since:
- 3.18.0
-
hasNullValue
Verifies that the atomic under test has thenullvalue.Example:
// assertion succeeds assertThat(new AtomicReference(null)).hasNullValue(); // assertion fails assertThat(new AtomicReference("foo")).hasNullValue();- Returns:
thisassertion object.- Throws:
AssertionError- if the atomic under test does not have the null value.- Since:
- 3.25.0
-
doesNotHaveNullValue
Verifies that the atomic under test does not have thenullvalue.Example:
// assertion succeeds assertThat(new AtomicReference("foo")).doesNotHaveNullValue(); // assertion fails assertThat(new AtomicReference(null)).doesNotHaveNullValue();- Returns:
thisassertion object.- Throws:
AssertionError- if the atomic under test has the null value.- Since:
- 3.25.0
-