SELF - the "self" type of this assertion class. Please read "Emulating 'self types' using Java Generics to simplify fluent API implementation"
for more details.ACTUAL - the type of the "actual" value.public abstract class AbstractAssert<SELF extends AbstractAssert<SELF,ACTUAL>,ACTUAL> extends Object implements Assert<SELF,ACTUAL>
| Modifier and Type | Field and Description |
|---|---|
protected ACTUAL |
actual |
WritableAssertionInfo |
info |
protected SELF |
myself |
protected Objects |
objects |
static boolean |
throwUnsupportedExceptionOnEquals |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractAssert(ACTUAL actual,
Class<?> selfType) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
areEqual(Object actual,
Object other)
Deprecated.
ComparisonStrategy will become part of the public API in the next major release and this method
will be removed. |
<ASSERT extends AbstractAssert<?,?>> |
asInstanceOf(InstanceOfAssertFactory<?,ASSERT> instanceOfAssertFactory)
Uses an
InstanceOfAssertFactory to verify that the actual value is an instance of a given type and to produce
a new Assert narrowed to that type. |
AbstractListAssert<?,List<?>,Object,ObjectAssert<Object>> |
asList()
Verifies that the actual value is an instance of List,
and returns a list assertion, to allow chaining of list-specific
assertions from this call.
|
protected AssertionError |
assertionError(ErrorMessageFactory errorMessageFactory) |
AbstractStringAssert<?> |
asString()
Returns a String assertion for the
toString() of the actual
value, to allow chaining of String-specific assertions from this call. |
SELF |
describedAs(Description description)
Sets the description of the assertion that is going to be called after.
|
String |
descriptionText()
The description of this assertion set with
Descriptable.describedAs(String, Object...) or
describedAs(Description). |
SELF |
doesNotHave(Condition<? super ACTUAL> condition)
Verifies that the actual value does not satisfy the given condition.
|
SELF |
doesNotHaveSameClassAs(Object other)
Verifies that the actual value does not have the same class as the given object.
|
SELF |
doesNotHaveSameHashCodeAs(Object other)
Verifies that the actual object does not have the same hashCode as the given object.
|
SELF |
doesNotHaveToString(String otherToString)
Verifies that actual
actual.toString() is not equal to the given String. |
boolean |
equals(Object obj)
Deprecated.
use
isEqualTo(java.lang.Object) instead |
protected <T,ASSERT extends AbstractAssert<?,?>> |
extracting(Function<? super ACTUAL,? extends T> extractor,
AssertFactory<T,ASSERT> assertFactory)
Uses the given
Function to extract a value from the object under test and creates a new assertion object
using the given assert factory. |
protected <ASSERT extends AbstractAssert<?,?>> |
extracting(String propertyOrField,
AssertFactory<Object,ASSERT> assertFactory)
Extracts the value of given field/property from the object under test and creates a new assertion object using the
given assert factory.
|
protected AssertionError |
failure(String errorMessage,
Object... arguments)
Generate a custom assertion error using the information in this assertion.
|
protected AssertionError |
failureWithActualExpected(Object actual,
Object expected,
String errorMessageFormat,
Object... arguments)
Generate a custom assertion error using the information in this assertion, using the given actual and expected values.
|
protected void |
failWithActualExpectedAndMessage(Object actual,
Object expected,
String errorMessageFormat,
Object... arguments)
Throw an assertion error based on information in this assertion.
|
protected void |
failWithMessage(String errorMessage,
Object... arguments)
Throw an assertion error based on information in this assertion.
|
WritableAssertionInfo |
getWritableAssertionInfo()
Exposes the
WritableAssertionInfo used in the current assertion for better extensibility.When writing your own assertion class, you can use the returned WritableAssertionInfo to change the error message and
still keep the description set by the assertion user. |
SELF |
has(Condition<? super ACTUAL> condition)
Verifies that the actual value satisfies the given condition.
|
int |
hashCode()
Always returns 1.
|
SELF |
hasSameClassAs(Object other)
Verifies that the actual value has the same class as the given object.
|
SELF |
hasSameHashCodeAs(Object other)
Verifies that the actual object has the same hashCode as the given object.
|
SELF |
hasToString(String expectedToString)
Verifies that actual
actual.toString() is equal to the given String. |
protected SELF |
inBinary()
Use binary object representation instead of standard representation in error messages.
|
protected SELF |
inHexadecimal()
Use hexadecimal object representation instead of standard representation in error messages.
|
SELF |
is(Condition<? super ACTUAL> condition)
Verifies that the actual value satisfies the given condition.
|
protected boolean |
isElementOfCustomAssert(StackTraceElement stackTraceElement) |
SELF |
isEqualTo(Object expected)
Verifies that the actual value is equal to the given one.
|
SELF |
isExactlyInstanceOf(Class<?> type)
Verifies that the actual value is exactly an instance of the given type.
|
SELF |
isIn(Iterable<?> values)
Verifies that the actual value is present in the given iterable.
|
SELF |
isIn(Object... values)
Verifies that the actual value is present in the given array of values.
|
SELF |
isInstanceOf(Class<?> type)
Verifies that the actual value is an instance of the given type.
|
SELF |
isInstanceOfAny(Class<?>... types)
Verifies that the actual value is an instance of any of the given types.
|
<T> SELF |
isInstanceOfSatisfying(Class<T> type,
Consumer<T> requirements)
Verifies that the actual value is an instance of the given type satisfying the given requirements expressed as a
Consumer. |
SELF |
isNot(Condition<? super ACTUAL> condition)
Verifies that the actual value does not satisfy the given condition.
|
SELF |
isNotEqualTo(Object other)
Verifies that the actual value is not equal to the given one.
|
SELF |
isNotExactlyInstanceOf(Class<?> type)
Verifies that the actual value is not exactly an instance of given type.
|
SELF |
isNotIn(Iterable<?> values)
Verifies that the actual value is not present in the given iterable.
|
SELF |
isNotIn(Object... values)
Verifies that the actual value is not present in the given array of values.
|
SELF |
isNotInstanceOf(Class<?> type)
Verifies that the actual value is not an instance of the given type.
|
SELF |
isNotInstanceOfAny(Class<?>... types)
Verifies that the actual value is not an instance of any of the given types.
|
SELF |
isNotNull()
Verifies that the actual value is not
null. |
SELF |
isNotOfAnyClassIn(Class<?>... types)
Verifies that the actual value type is not in given types.
|
SELF |
isNotSameAs(Object other)
Verifies that the actual value is not the same as the given one, ie using == comparison.
|
void |
isNull()
Verifies that the actual value is
null. |
SELF |
isOfAnyClassIn(Class<?>... types)
Verifies that the actual value type is in given types.
|
SELF |
isSameAs(Object expected)
Verifies that the actual value is the same as the given one, ie using == comparison.
|
SELF |
matches(Predicate<? super ACTUAL> predicate)
Verifies that the actual object matches the given predicate.
|
SELF |
matches(Predicate<? super ACTUAL> predicate,
String predicateDescription)
Verifies that the actual object matches the given predicate, the predicate description is used to get an
informative error message.
|
protected <E> AbstractListAssert<?,List<? extends E>,E,ObjectAssert<E>> |
newListAssertInstance(List<? extends E> newActual)
Create a
AbstractListAssert from the given list. |
SELF |
overridingErrorMessage(String newErrorMessage,
Object... args)
Overrides AssertJ default error message by the given one.
|
SELF |
overridingErrorMessage(Supplier<String> supplier)
Overrides AssertJ default error message by the given one.
|
SELF |
satisfies(Condition<? super ACTUAL> condition)
Verifies that the actual value satisfies the given condition.
|
SELF |
satisfies(Consumer<? super ACTUAL>... requirements)
Verifies that the actual object satisfied the given requirements expressed as
Consumers. |
SELF |
satisfies(ThrowingConsumer<? super ACTUAL>... assertions)
Verifies that the actual object satisfied the given requirements expressed as
ThrowingConsumers. |
SELF |
satisfiesAnyOf(Consumer<? super ACTUAL>... assertions)
Verifies that the actual object under test satisfies at least one of the given assertions group expressed as
Consumers. |
SELF |
satisfiesAnyOf(ThrowingConsumer<? super ACTUAL>... assertions)
Verifies that the actual object under test satisfies at least one of the given assertions group expressed as
ThrowingConsumers. |
protected SELF |
satisfiesAnyOfForProxy(Consumer<? super ACTUAL>[] assertionsGroups) |
protected SELF |
satisfiesForProxy(Consumer<? super ACTUAL>[] assertionsGroups) |
static void |
setCustomRepresentation(Representation customRepresentation) |
static void |
setDescriptionConsumer(Consumer<Description> descriptionConsumer) |
static void |
setPrintAssertionsDescription(boolean printAssertionsDescription) |
protected void |
throwAssertionError(ErrorMessageFactory errorMessageFactory)
Utility method to throw an
AssertionError given a BasicErrorMessageFactory. |
SELF |
usingComparator(Comparator<? super ACTUAL> customComparator)
Use the given custom comparator instead of relying on actual type A equals method for incoming assertion checks.
|
SELF |
usingComparator(Comparator<? super ACTUAL> customComparator,
String customComparatorDescription)
Use the given custom comparator instead of relying on actual type A equals method for incoming assertion checks.
|
SELF |
usingDefaultComparator()
Revert to standard comparison for the incoming assertion checks.
|
protected RecursiveComparisonAssert<?> |
usingRecursiveComparison() |
protected RecursiveComparisonAssert<?> |
usingRecursiveComparison(RecursiveComparisonConfiguration recursiveComparisonConfiguration) |
SELF |
withFailMessage(String newErrorMessage,
Object... args)
Alternative method for
overridingErrorMessage(java.lang.String, java.lang.Object...) |
SELF |
withFailMessage(Supplier<String> supplier)
Alternative method for
overridingErrorMessage(java.lang.String, java.lang.Object...) |
SELF |
withRepresentation(Representation representation)
Use the given
Representation to describe/represent values in AssertJ error messages. |
SELF |
withThreadDumpOnError()
In case of an assertion error, a thread dump will be printed to
System.err. |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitas, as, as, describedAspublic static boolean throwUnsupportedExceptionOnEquals
protected Objects objects
public WritableAssertionInfo info
protected final ACTUAL actual
protected final SELF extends AbstractAssert<SELF,ACTUAL> myself
public WritableAssertionInfo getWritableAssertionInfo()
WritableAssertionInfo used in the current assertion for better extensibility.WritableAssertionInfo to change the error message and
still keep the description set by the assertion user.WritableAssertionInfo used in the current assertionprotected void failWithMessage(String errorMessage, Object... arguments)
throw failure(errorMessage, arguments);
This method is a thin wrapper around failure() - see that method for a more detailed
description.
Note that generally speaking, using failure() directly is preferable to using this
wrapper method, as the compiler and other code analysis tools will be able to tell that the statement will never return
normally and respond appropriately.
errorMessage - the error message to formatarguments - the arguments referenced by the format specifiers in the errorMessage string.failWithActualExpectedAndMessage(Object, Object, String, Object...),
failure(String, Object...)protected AssertionError failure(String errorMessage, Object... arguments)
This is a utility method to ease writing custom assertions classes using String.format(String, Object...) specifiers
in error message.
Moreover, this method honors any description set with Descriptable.as(String, Object...) or overridden error message
defined by the user with overridingErrorMessage(String, Object...).
Example:
public TolkienCharacterAssert hasName(String name) {
// check that actual TolkienCharacter we want to make assertions on is not null.
isNotNull();
// check condition
if (!actual.getName().equals(name)) {
failWithMessage("Expected character's name to be <%s> but was <%s>", name, actual.getName());
}
// return the current assertion for method chaining
return this;
}errorMessage - the error message to formatarguments - the arguments referenced by the format specifiers in the errorMessage string.failureWithActualExpected(Object, Object, String, Object...),
failWithMessage(String, Object...)protected void failWithActualExpectedAndMessage(Object actual, Object expected, String errorMessageFormat, Object... arguments)
throw failureWithActualExpected(actual, expected, errorMessageFormat, arguments);
This method is a thin wrapper around failureWithActualExpected() -
see that method for a more detailed description. Note that generally speaking, using
failureWithActualExpected() directly is
preferable to using this wrapper method, as the compiler and other code analysis tools will be able to tell that the
statement will never return normally and respond appropriately.
actual - the actual object that was found during the testexpected - the object that was expectederrorMessageFormat - the error message to formatarguments - the arguments referenced by the format specifiers in the errorMessage string.failWithMessage(String, Object...),
failureWithActualExpected(Object, Object, String, Object...)protected AssertionError failureWithActualExpected(Object actual, Object expected, String errorMessageFormat, Object... arguments)
This is a utility method to ease writing custom assertions classes using String.format(String, Object...) specifiers
in error message with actual and expected values.
Moreover, this method honors any description set with Descriptable.as(String, Object...) or overridden error message
defined by the user with overridingErrorMessage(String, Object...).
This method also sets the "actual" and "expected" fields of the assertion if available (eg, if OpenTest4J is on the path). This aids IDEs to produce visual diffs of the resulting values.
Example :
public TolkienCharacterAssert hasName(String name) {
// check that actual TolkienCharacter we want to make assertions on is not null.
isNotNull();
// check condition
if (!actual.getName().equals(name)) {
throw failureWithActualExpected(actual.getName(), name, "Expected character's name to be <%s> but was <%s>", name, actual.getName());
}
// return the current assertion for method chaining
return this;
}actual - the actual object that was found during the testexpected - the object that was expectederrorMessageFormat - the error message to formatarguments - the arguments referenced by the format specifiers in the errorMessage string.failure(String, Object...),
failWithActualExpectedAndMessage(Object, Object, String, Object...)protected void throwAssertionError(ErrorMessageFactory errorMessageFactory)
AssertionError given a BasicErrorMessageFactory.
Instead of writing ...
throw Failures.instance().failure(info, ShouldBePresent.shouldBePresent());
... you can simply write :
throwAssertionError(info, ShouldBePresent.shouldBePresent());errorMessageFactory - used to define the error message.AssertionError - with a message corresponding to the given BasicErrorMessageFactory.protected AssertionError assertionError(ErrorMessageFactory errorMessageFactory)
protected boolean isElementOfCustomAssert(StackTraceElement stackTraceElement)
protected SELF inHexadecimal()
It can be useful when comparing UNICODE characters - many unicode chars have duplicate characters assigned, it is thus impossible to find differences from the standard error message:
With standard message:
assertThat("µµµ").contains("μμμ");
java.lang.AssertionError:
Expecting:
<"µµµ">
to contain:
<"μμμ">
With Hexadecimal message:
assertThat("µµµ").inHexadecimal().contains("μμμ");
java.lang.AssertionError:
Expecting:
<"['00B5', '00B5', '00B5']">
to contain:
<"['03BC', '03BC', '03BC']">this assertion object.protected SELF inBinary()
Example:
assertThat(1).inBinary().isEqualTo(2);
org.junit.ComparisonFailure:
Expected :0b00000000_00000000_00000000_00000010
Actual :0b00000000_00000000_00000000_00000001this assertion object.public SELF describedAs(Description description)
You must set it before calling the assertion otherwise it is ignored as the failing assertion breaks the chained call by throwing an AssertionError.
This overloaded version of "describedAs" offers more flexibility than the one taking a String by allowing
users to pass their own implementation of a description. For example, a description that creates its value lazily,
only when an assertion failure occurs.
describedAs in interface Descriptable<SELF extends AbstractAssert<SELF,ACTUAL>>description - the new description to set.this object.public SELF isEqualTo(Object expected)
Example:
// assertions succeed
assertThat("abc").isEqualTo("abc");
assertThat(new HashMap<String, Integer>()).isEqualTo(new HashMap<String, Integer>());
// assertions fail
assertThat("abc").isEqualTo("123");
assertThat(new ArrayList<String>()).isEqualTo(1);public SELF isNotEqualTo(Object other)
Example:
// assertions succeed
assertThat("abc").isNotEqualTo("123");
assertThat(new ArrayList<String>()).isNotEqualTo(1);
// assertions fail
assertThat("abc").isNotEqualTo("abc");
assertThat(new HashMap<String, Integer>()).isNotEqualTo(new HashMap<String, Integer>());isNotEqualTo in interface Assert<SELF extends AbstractAssert<SELF,ACTUAL>,ACTUAL>other - the given value to compare the actual value to.this assertion object.public void isNull()
null.
Example:
String value = null;
// assertion succeeds
assertThat(value).isNull();
// assertions fail
assertThat("abc").isNull();
assertThat(new HashMap<String, Integer>()).isNull();public SELF isNotNull()
null.
Example:
// assertions succeed
assertThat("abc").isNotNull();
assertThat(new HashMap<String, Integer>()).isNotNull();
// assertions fails
String value = null;
assertThat(value).isNotNull();public SELF isSameAs(Object expected)
Example:
// Name is a class with first and last fields, two Names are equals if both first and last are equals.
Name tyrion = new Name("Tyrion", "Lannister");
Name alias = tyrion;
Name clone = new Name("Tyrion", "Lannister");
// assertions succeed:
assertThat(tyrion).isSameAs(alias)
.isEqualTo(clone);
// assertion fails:
assertThat(tyrion).isSameAs(clone);public SELF isNotSameAs(Object other)
Example:
// Name is a class with first and last fields, two Names are equals if both first and last are equals.
Name tyrion = new Name("Tyrion", "Lannister");
Name alias = tyrion;
Name clone = new Name("Tyrion", "Lannister");
// assertions succeed:
assertThat(clone).isNotSameAs(tyrion)
.isEqualTo(tyrion);
// assertion fails:
assertThat(alias).isNotSameAs(tyrion);isNotSameAs in interface Assert<SELF extends AbstractAssert<SELF,ACTUAL>,ACTUAL>other - the given value to compare the actual value to.this assertion object.public SELF isIn(Object... values)
This assertion always fails if the given array of values is empty.
Example:
Ring[] elvesRings = new Ring[] { vilya, nenya, narya };
// assertion succeeds
assertThat(nenya).isIn(elvesRings);
// assertions fail
assertThat(oneRing).isIn(elvesRings);
assertThat(oneRing).isIn(new Ring[0]);public SELF isNotIn(Object... values)
This assertion always succeeds if the given array of values is empty.
Example:
Ring[] elvesRings = new Ring[] { vilya, nenya, narya };
// assertions succeed
assertThat(oneRing).isNotIn(elvesRings);
assertThat(oneRing).isNotIn(new Ring[0]);
// assertions fails:
assertThat(nenya).isNotIn(elvesRings);public SELF isIn(Iterable<?> values)
This assertion always fails if the given iterable is empty.
Example:
Iterable<Ring> elvesRings = list(vilya, nenya, narya);
// assertion succeeds
assertThat(nenya).isIn(elvesRings);
// assertions fail:
assertThat(oneRing).isIn(elvesRings);
assertThat(oneRing).isIn(emptyList());public SELF isNotIn(Iterable<?> values)
This assertion always succeeds if the given iterable is empty.
Example:
Iterable<Ring> elvesRings = list(vilya, nenya, narya);
// assertions succeed:
assertThat(oneRing).isNotIn(elvesRings);
assertThat(oneRing).isNotIn(emptyList());
// assertions fails:
assertThat(nenya).isNotIn(elvesRings);public SELF is(Condition<? super ACTUAL> condition)
ExtensionPoints.has(Condition).is in interface ExtensionPoints<SELF extends AbstractAssert<SELF,ACTUAL>,ACTUAL>condition - the given condition.this ExtensionPoints object.ExtensionPoints.has(Condition)public SELF isNot(Condition<? super ACTUAL> condition)
ExtensionPoints.doesNotHave(Condition).isNot in interface ExtensionPoints<SELF extends AbstractAssert<SELF,ACTUAL>,ACTUAL>condition - the given condition.this ExtensionPoints object.ExtensionPoints.isNot(Condition)public SELF has(Condition<? super ACTUAL> condition)
ExtensionPoints.is(Condition)
.has in interface ExtensionPoints<SELF extends AbstractAssert<SELF,ACTUAL>,ACTUAL>condition - the given condition.this ExtensionPoints object.ExtensionPoints.is(Condition)public SELF doesNotHave(Condition<? super ACTUAL> condition)
ExtensionPoints.isNot(Condition).doesNotHave in interface ExtensionPoints<SELF extends AbstractAssert<SELF,ACTUAL>,ACTUAL>condition - the given condition.this ExtensionPoints object.ExtensionPoints.isNot(Condition)public SELF satisfies(Condition<? super ACTUAL> condition)
ExtensionPoints.is(Condition).
Example:
// Given
Condition<String> fairyTale = new Condition<>(s -> s.startsWith("Once upon a time"), "fairy tale start");
// When
String littleRedCap = "Once upon a time there was a dear little girl ...";
// Then
assertThat(littleRedCap).satisfies(fairyTale);satisfies in interface ExtensionPoints<SELF extends AbstractAssert<SELF,ACTUAL>,ACTUAL>condition - the given condition.this ExtensionPoints object.ExtensionPoints.is(Condition)public <ASSERT extends AbstractAssert<?,?>> ASSERT asInstanceOf(InstanceOfAssertFactory<?,ASSERT> instanceOfAssertFactory)
InstanceOfAssertFactory to verify that the actual value is an instance of a given type and to produce
a new Assert narrowed to that type.
InstanceOfAssertFactories provides static factories for all the types supported by Assertions#assertThat.
Additional factories can be created with custom InstanceOfAssertFactory instances.
Example:
// assertions succeeds
Object string = "abc";
assertThat(string).asInstanceOf(InstanceOfAssertFactories.STRING).startsWith("ab");
Object integer = 1;
assertThat(integer).asInstanceOf(InstanceOfAssertFactories.INTEGER).isNotZero();
// assertions fails
assertThat("abc").asInstanceOf(InstanceOfAssertFactories.INTEGER);asInstanceOf in interface Assert<SELF extends AbstractAssert<SELF,ACTUAL>,ACTUAL>ASSERT - the type of the resulting Assert.instanceOfAssertFactory - the factory which verifies the type and creates the new Assert.Assert instance.InstanceOfAssertFactory,
InstanceOfAssertFactoriespublic SELF isInstanceOf(Class<?> type)
Example:
// assertions succeed
assertThat("abc").isInstanceOf(String.class);
assertThat(new HashMap<String, Integer>()).isInstanceOf(HashMap.class);
assertThat(new HashMap<String, Integer>()).isInstanceOf(Map.class);
// assertions fail
assertThat(1).isInstanceOf(String.class);
assertThat(new ArrayList<String>()).isInstanceOf(LinkedList.class);isInstanceOf in interface Assert<SELF extends AbstractAssert<SELF,ACTUAL>,ACTUAL>type - the type to check the actual value against.public <T> SELF isInstanceOfSatisfying(Class<T> type, Consumer<T> requirements)
Consumer.
This is useful to perform a group of assertions on a single object after checking its runtime type.
Example:
// second constructor parameter is the light saber color
Object yoda = new Jedi("Yoda", "Green");
Object luke = new Jedi("Luke Skywalker", "Green");
Consumer<Jedi> jediRequirements = jedi -> {
assertThat(jedi.getLightSaberColor()).isEqualTo("Green");
assertThat(jedi.getName()).doesNotContain("Dark");
};
// assertions succeed:
assertThat(yoda).isInstanceOfSatisfying(Jedi.class, jediRequirements);
assertThat(luke).isInstanceOfSatisfying(Jedi.class, jediRequirements);
// assertions fail:
Jedi vader = new Jedi("Vader", "Red");
assertThat(vader).isInstanceOfSatisfying(Jedi.class, jediRequirements);
// not a Jedi !
assertThat("foo").isInstanceOfSatisfying(Jedi.class, jediRequirements);isInstanceOfSatisfying in interface Assert<SELF extends AbstractAssert<SELF,ACTUAL>,ACTUAL>T - the generic type to check the actual value against.type - the type to check the actual value against.requirements - the requirements expressed as a Consumer.public SELF isInstanceOfAny(Class<?>... types)
Example:
// assertions succeed
assertThat("abc").isInstanceOfAny(String.class, Integer.class);
assertThat(new ArrayList<String>()).isInstanceOfAny(LinkedList.class, ArrayList.class);
assertThat(new HashMap<String, Integer>()).isInstanceOfAny(TreeMap.class, Map.class);
// assertions fail
assertThat(1).isInstanceOfAny(Double.class, Float.class);
assertThat(new ArrayList<String>()).isInstanceOfAny(LinkedList.class, Vector.class);isInstanceOfAny in interface Assert<SELF extends AbstractAssert<SELF,ACTUAL>,ACTUAL>types - the types to check the actual value against.public SELF isNotInstanceOf(Class<?> type)
Example:
// assertions succeed
assertThat(1).isNotInstanceOf(Double.class);
assertThat(new ArrayList<String>()).isNotInstanceOf(LinkedList.class);
// assertions fail
assertThat("abc").isNotInstanceOf(String.class);
assertThat(new HashMap<String, Integer>()).isNotInstanceOf(HashMap.class);
assertThat(new HashMap<String, Integer>()).isNotInstanceOf(Map.class);isNotInstanceOf in interface Assert<SELF extends AbstractAssert<SELF,ACTUAL>,ACTUAL>type - the type to check the actual value against.public SELF isNotInstanceOfAny(Class<?>... types)
Example:
// assertions succeed
assertThat(1).isNotInstanceOfAny(Double.class, Float.class);
assertThat(new ArrayList<String>()).isNotInstanceOfAny(LinkedList.class, Vector.class);
// assertions fail
assertThat(1).isNotInstanceOfAny(Double.class, Integer.class);
assertThat(new ArrayList<String>()).isNotInstanceOfAny(LinkedList.class, ArrayList.class);
assertThat(new HashMap<String, Integer>()).isNotInstanceOfAny(TreeMap.class, Map.class);isNotInstanceOfAny in interface Assert<SELF extends AbstractAssert<SELF,ACTUAL>,ACTUAL>types - the types to check the actual value against.public SELF hasSameClassAs(Object other)
Example:
// assertions succeed
assertThat(1).hasSameClassAs(2);
assertThat("abc").hasSameClassAs("123");
assertThat(new ArrayList<String>()).hasSameClassAs(new ArrayList<Integer>());
// assertions fail
assertThat(1).hasSameClassAs("abc");
assertThat(new ArrayList<String>()).hasSameClassAs(new LinkedList<String>());hasSameClassAs in interface Assert<SELF extends AbstractAssert<SELF,ACTUAL>,ACTUAL>other - the object to check type against.public SELF hasToString(String expectedToString)
actual.toString() is equal to the given String.
Example :
CartoonCharacter homer = new CartoonCharacter("Homer");
// Instead of writing ...
assertThat(homer.toString()).isEqualTo("Homer");
// ... you can simply write:
assertThat(homer).hasToString("Homer");hasToString in interface Assert<SELF extends AbstractAssert<SELF,ACTUAL>,ACTUAL>expectedToString - the expected String description of actual.public SELF doesNotHaveToString(String otherToString)
actual.toString() is not equal to the given String.
Example :
CartoonCharacter homer = new CartoonCharacter("Homer");
// Instead of writing ...
assertThat(homer.toString()).isNotEqualTo("Marge");
// ... you can simply write:
assertThat(homer).doesNotHaveToString("Marge");doesNotHaveToString in interface Assert<SELF extends AbstractAssert<SELF,ACTUAL>,ACTUAL>otherToString - the String to check against.public SELF doesNotHaveSameClassAs(Object other)
Example:
// assertions succeed
assertThat(1).doesNotHaveSameClassAs("abc");
assertThat(new ArrayList<String>()).doesNotHaveSameClassAs(new LinkedList<String>());
// assertions fail
assertThat(1).doesNotHaveSameClassAs(2);
assertThat("abc").doesNotHaveSameClassAs("123");
assertThat(new ArrayList<String>()).doesNotHaveSameClassAs(new ArrayList<Integer>());doesNotHaveSameClassAs in interface Assert<SELF extends AbstractAssert<SELF,ACTUAL>,ACTUAL>other - the object to check type against.public SELF isExactlyInstanceOf(Class<?> type)
Example:
// assertions succeed
assertThat("abc").isExactlyInstanceOf(String.class);
assertThat(new ArrayList<String>()).isExactlyInstanceOf(ArrayList.class);
assertThat(new HashMap<String, Integer>()).isExactlyInstanceOf(HashMap.class);
// assertions fail
assertThat(1).isExactlyInstanceOf(String.class);
assertThat(new ArrayList<String>()).isExactlyInstanceOf(List.class);
assertThat(new HashMap<String, Integer>()).isExactlyInstanceOf(Map.class);isExactlyInstanceOf in interface Assert<SELF extends AbstractAssert<SELF,ACTUAL>,ACTUAL>type - the type to check the actual value against.public SELF isNotExactlyInstanceOf(Class<?> type)
Example:
// assertions succeed
assertThat(1).isNotExactlyInstanceOf(String.class);
assertThat(new ArrayList<String>()).isNotExactlyInstanceOf(List.class);
assertThat(new HashMap<String, Integer>()).isNotExactlyInstanceOf(Map.class);
// assertions fail
assertThat("abc").isNotExactlyInstanceOf(String.class);
assertThat(new ArrayList<String>()).isNotExactlyInstanceOf(ArrayList.class);
assertThat(new HashMap<String, Integer>()).isNotExactlyInstanceOf(HashMap.class);isNotExactlyInstanceOf in interface Assert<SELF extends AbstractAssert<SELF,ACTUAL>,ACTUAL>type - the type to check the actual value against.public SELF isOfAnyClassIn(Class<?>... types)
Example:
// assertions succeed
assertThat(new HashMap<String, Integer>()).isOfAnyClassIn(HashMap.class, TreeMap.class);
assertThat(new ArrayList<String>()).isOfAnyClassIn(ArrayList.class, LinkedList.class);
// assertions fail
assertThat(new HashMap<String, Integer>()).isOfAnyClassIn(TreeMap.class, Map.class);
assertThat(new ArrayList<String>()).isOfAnyClassIn(LinkedList.class, List.class);isOfAnyClassIn in interface Assert<SELF extends AbstractAssert<SELF,ACTUAL>,ACTUAL>types - the types to check the actual value against.public SELF isNotOfAnyClassIn(Class<?>... types)
Example:
// assertions succeed
assertThat(new HashMap<String, Integer>()).isNotOfAnyClassIn(Map.class, TreeMap.class);
assertThat(new ArrayList<String>()).isNotOfAnyClassIn(LinkedList.class, List.class);
// assertions fail
assertThat(new HashMap<String, Integer>()).isNotOfAnyClassIn(HashMap.class, TreeMap.class);
assertThat(new ArrayList<String>()).isNotOfAnyClassIn(ArrayList.class, LinkedList.class);isNotOfAnyClassIn in interface Assert<SELF extends AbstractAssert<SELF,ACTUAL>,ACTUAL>types - the types to check the actual value against.public AbstractListAssert<?,List<?>,Object,ObjectAssert<Object>> asList()
Example :
Object sortedListAsObject = Arrays.asList(1, 2, 3);
// assertion succeeds
assertThat(sortedListAsObject).asList().isSorted();
Object unsortedListAsObject = Arrays.asList(3, 1, 2);
// assertions fails
assertThat(unsortedListAsObject).asList().isSorted();public AbstractStringAssert<?> asString()
toString() of the actual
value, to allow chaining of String-specific assertions from this call.
Example :
Object stringAsObject = "hello world";
// assertion succeeds
assertThat(stringAsObject).asString().contains("hello");
// assertions fails
assertThat(stringAsObject).asString().contains("holla");public String descriptionText()
Descriptable.describedAs(String, Object...) or
describedAs(Description).public SELF overridingErrorMessage(String newErrorMessage, Object... args)
You must set it before calling the assertion otherwise it is ignored as the failing assertion breaks the chained call by throwing an AssertionError.
The new error message is built using String.format(String, Object...) if you provide args parameter (if you
don't, the error message is taken as it is).
Example :
assertThat(player.isRookie()).overridingErrorMessage("Expecting Player <%s> to be a rookie but was not.", player)
.isTrue();newErrorMessage - the error message that will replace the default one provided by Assertj.args - the args used to fill error message as in String.format(String, Object...).public SELF overridingErrorMessage(Supplier<String> supplier)
The new error message is only built if the assertion fails (by consuming the given supplier), this is useful if building messages is expensive.
You must set the message before calling the assertion otherwise it is ignored as the failing assertion breaks
the call chain by throwing an AssertionError.
Example :
assertThat(player.isRookie()).overridingErrorMessage(() -> "Expecting Player to be a rookie but was not.")
.isTrue();supplier - the supplier supplies error message that will replace the default one provided by Assertj.public SELF withFailMessage(String newErrorMessage, Object... args)
overridingErrorMessage(java.lang.String, java.lang.Object...)
You must set it before calling the assertion otherwise it is ignored as the failing assertion breaks the chained call by throwing an AssertionError.
Example:
assertThat(player.isRookie()).withFailMessage("Expecting Player <%s> to be a rookie but was not.", player)
.isTrue();newErrorMessage - the error message that will replace the default one provided by Assertj.args - the args used to fill error message as in String.format(String, Object...).public SELF withFailMessage(Supplier<String> supplier)
overridingErrorMessage(java.lang.String, java.lang.Object...)
The new error message is only built if the assertion fails (by consuming the given supplier), this is useful if building messages is expensive.
You must set the message before calling the assertion otherwise it is ignored as the failing assertion breaks
the call chain by throwing an AssertionError.
Example:
assertThat(player.isRookie()).withFailMessage(() -> "Expecting Player to be a rookie but was not.")
.isTrue();supplier - the supplier supplies error message that will replace the default one provided by Assertj.public SELF usingComparator(Comparator<? super ACTUAL> customComparator)
The custom comparator is bound to assertion instance, meaning that if a new assertion instance is created, the default comparison strategy will be used.
Examples :
// frodo and sam are instances of Character with Hobbit race (obviously :).
// raceComparator implements Comparator<Character>
assertThat(frodo).usingComparator(raceComparator).isEqualTo(sam);usingComparator in interface Assert<SELF extends AbstractAssert<SELF,ACTUAL>,ACTUAL>customComparator - the comparator to use for the incoming assertion checks.this assertion object.public SELF usingComparator(Comparator<? super ACTUAL> customComparator, String customComparatorDescription)
The custom comparator is bound to assertion instance, meaning that if a new assertion instance is created, the default comparison strategy will be used.
Examples :
// frodo and sam are instances of Character with Hobbit race (obviously :).
// raceComparator implements Comparator<Character>
assertThat(frodo).usingComparator(raceComparator, "Hobbit Race Comparator").isEqualTo(sam);usingComparator in interface Assert<SELF extends AbstractAssert<SELF,ACTUAL>,ACTUAL>customComparator - the comparator to use for the incoming assertion checks.customComparatorDescription - comparator description to be used in assertion error messagesthis assertion object.public SELF usingDefaultComparator()
This method should be used to disable a custom comparison strategy set by calling usingComparator.
usingDefaultComparator in interface Assert<SELF extends AbstractAssert<SELF,ACTUAL>,ACTUAL>this assertion object.public SELF withThreadDumpOnError()
System.err.
Example :
assertThat("Messi").withThreadDumpOnError().isEqualTo("Ronaldo");
will print a thread dump, something similar to this:
"JDWP Command Reader"
java.lang.Thread.State: RUNNABLE
"JDWP Event Helper Thread"
java.lang.Thread.State: RUNNABLE
"JDWP Transport Listener: dt_socket"
java.lang.Thread.State: RUNNABLE
"Signal Dispatcher"
java.lang.Thread.State: RUNNABLE
"Finalizer"
java.lang.Thread.State: WAITING
at java.lang.Object.wait(Native Method)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:135)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:151)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:189)
"Reference Handler"
java.lang.Thread.State: WAITING
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:503)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:133)
"main"
java.lang.Thread.State: RUNNABLE
at sun.management.ThreadImpl.dumpThreads0(Native Method)
at sun.management.ThreadImpl.dumpAllThreads(ThreadImpl.java:446)
at org.assertj.core.internal.Failures.threadDumpDescription(Failures.java:193)
at org.assertj.core.internal.Failures.printThreadDumpIfNeeded(Failures.java:141)
at org.assertj.core.internal.Failures.failure(Failures.java:91)
at org.assertj.core.internal.Objects.assertEqual(Objects.java:314)
at org.assertj.core.api.AbstractAssert.isEqualTo(AbstractAssert.java:198)
at org.assertj.examples.ThreadDumpOnErrorExample.main(ThreadDumpOnErrorExample.java:28)withThreadDumpOnError in interface Assert<SELF extends AbstractAssert<SELF,ACTUAL>,ACTUAL>public SELF withRepresentation(Representation representation)
Representation to describe/represent values in AssertJ error messages.
The usual way to introduce a new Representation is to extend StandardRepresentation
and override any existing toStringOf methods that don't suit you. For example you can control
Date formatting by overriding StandardRepresentation.toStringOf(Date)).
You can also control other types format by overriding StandardRepresentation.toStringOf(Object))
calling your formatting method first and then fall back to the default representation by calling super.toStringOf(Object).
Example :
private class Example {}
private class CustomRepresentation extends StandardRepresentation {
// override needed to hook specific formatting
@Override
public String toStringOf(Object o) {
if (o instanceof Example) return "Example";
// fall back to default formatting
return super.toStringOf(o);
}
// change String representation
@Override
protected String toStringOf(String s) {
return "$" + s + "$";
}
}
// next assertion fails with error : "expected:<[null]> but was:<[Example]>"
Example example = new Example();
assertThat(example).withRepresentation(new CustomRepresentation())
.isNull(); // example is not null !
// next assertion fails ...
assertThat("foo").withRepresentation(new CustomRepresentation())
.startsWith("bar");
// ... with error :
Expecting:
<$foo$>
to start with:
<$bar$>withRepresentation in interface Assert<SELF extends AbstractAssert<SELF,ACTUAL>,ACTUAL>representation - Describe/represent values in AssertJ error messages.@Deprecated public boolean equals(Object obj)
isEqualTo(java.lang.Object) insteadequals in interface Assert<SELF extends AbstractAssert<SELF,ACTUAL>,ACTUAL>equals in class ObjectUnsupportedOperationException - if this method is called.public SELF matches(Predicate<? super ACTUAL> predicate)
Example :
assertThat(player).matches(p -> p.isRookie());predicate - the Predicate to matchthis assertion object.AssertionError - if the actual does not match the given Predicate.NullPointerException - if given Predicate is null.public SELF matches(Predicate<? super ACTUAL> predicate, String predicateDescription)
Example :
assertThat(player).matches(p -> p.isRookie(), "is rookie");
The error message contains the predicate description, if the previous assertion fails, it will be:
Expecting:
<player>
to match 'is rookie' predicate.predicate - the Predicate to matchpredicateDescription - a description of the Predicate used in the error messagethis assertion object.AssertionError - if the actual does not match the given Predicate.NullPointerException - if given Predicate is null.NullPointerException - if given predicateDescription is null.@SafeVarargs public final SELF satisfies(Consumer<? super ACTUAL>... requirements)
Consumers.
This is useful to perform a group of assertions on a single object, each passed assertion is evaluated and all failures are reported (to be precise each assertion can lead to one failure max).
Grouping assertions example :
// second constructor parameter is the light saber color
Jedi yoda = new Jedi("Yoda", "Green");
Jedi luke = new Jedi("Luke Skywalker", "Green");
Consumer<Jedi> redLightSaber = jedi -> assertThat(jedi.getLightSaberColor()).isEqualTo("Red");
Consumer<Jedi> greenLightSaber = jedi -> assertThat(jedi.getLightSaberColor()).isEqualTo("Green");
Consumer<Jedi> notDarth = jedi -> assertThat(jedi.getName()).doesNotContain("Darth");
Consumer<Jedi> darth = jedi -> assertThat(jedi.getName()).contains("Darth");
// assertions succeed:
assertThat(yoda).satisfies(greenLightSaber);
assertThat(luke).satisfies(greenLightSaber, notDarth);
// assertions fail:
Jedi vader = new Jedi("Darth Vader", "Red");
assertThat(vader).satisfies(greenLightSaber);
assertThat(vader).satisfies(darth, greenLightSaber);
assertThat(vader).satisfies(greenLightSaber, notDarth);
In the following example, satisfies prevents the need to define a local variable in order to run multiple assertions:
// no need to define team.getPlayers().get(0).getStats() as a local variable
assertThat(team.getPlayers().get(0).getStats()).satisfies(stats -> assertThat(stats.pointPerGame).isGreaterThan(25.7),
stats -> assertThat(stats.assistsPerGame).isGreaterThan(7.2),
stats -> assertThat(stats.reboundsPerGame).isBetween(9, 12));requirements - to assert on the actual object - must not be null.NullPointerException - if any given Consumer is null@SafeVarargs public final SELF satisfies(ThrowingConsumer<? super ACTUAL>... assertions)
ThrowingConsumers.
This is the same assertion as satisfies(Consumer[]) except that a ThrowingConsumer rethrows checked exceptions as RuntimeException.
More precisely, RuntimeException and AssertionError are rethrown as they are and Throwable wrapped in a RuntimeException.
If each assertion is passed as a separate argument, all of them will be evaluated and assertion error will contain all failures.
Example:
// read() throws IOException
ThrowingConsumer<Reader> hasReachedEOF = reader -> assertThat(reader.read()).isEqualTo(-1);
ThrowingConsumer<Reader> nextCharacterA = reader -> assertThat(reader.read()).isEqualTo('a');
ThrowingConsumer<Reader> nextCharacterB = reader -> assertThat(reader.read()).isEqualTo('b');
ThrowingConsumer<Reader> nextCharacterZ = reader -> assertThat(reader.read()).isEqualTo('z');
// alphabet.txt contains: abcdefghijklmnopqrstuvwxyz
// empty.txt is empty
// assertion succeeds:
assertThat(new FileReader("empty.txt")).satisfies(hasReachedEOF);
assertThat(new FileReader("alphabet.txt")).satisfies(nextCharacterA, nextCharacterB);
// assertion fails:
assertThat(new FileReader("alphabet.txt")).satisfies(nextCharacterA, hasReachedEOF);
assertThat(new FileReader("alphabet.txt")).satisfies(nextCharacterB, nextCharacterZ);assertions - the group of assertions to run against the object under test - must not be null.IllegalArgumentException - if any given assertions group is nullRuntimeException - rethrown as is by the given ThrowingConsumer or wrapping any Throwable.AssertionError - rethrown as is by the given ThrowingConsumerprotected SELF satisfiesForProxy(Consumer<? super ACTUAL>[] assertionsGroups) throws AssertionError
AssertionError@SafeVarargs public final SELF satisfiesAnyOf(Consumer<? super ACTUAL>... assertions)
Consumers.
This allows users to perform OR like assertions since only one the assertions group has to be met.
Overriding error message is not supported as it would prevent from
getting the error messages of the failing assertions, these are valuable to figure out what went wrong.
Describing the assertion is supported (for example with Descriptable.as(String, Object...)).
Example:
TolkienCharacter frodo = new TolkienCharacter("Frodo", HOBBIT);
Consumer<TolkienCharacter> isHobbit = tolkienCharacter -> assertThat(tolkienCharacter.getRace()).isEqualTo(HOBBIT);
Consumer<TolkienCharacter> isElf = tolkienCharacter -> assertThat(tolkienCharacter.getRace()).isEqualTo(ELF);
Consumer<TolkienCharacter> isDwarf = tolkienCharacter -> assertThat(tolkienCharacter.getRace()).isEqualTo(DWARF);
// assertion succeeds:
assertThat(frodo).satisfiesAnyOf(isElf, isHobbit, isDwarf);
// assertion fails:
TolkienCharacter boromir = new TolkienCharacter("Boromir", MAN);
assertThat(boromir).satisfiesAnyOf(isHobbit, isElf, isDwarf);assertions - the group of assertions to run against the object under test - must not be null.IllegalArgumentException - if any given assertions group is null@SafeVarargs public final SELF satisfiesAnyOf(ThrowingConsumer<? super ACTUAL>... assertions)
ThrowingConsumers.
This allows users to perform OR like assertions since only one the assertions group has to be met.
This is the same assertion as satisfiesAnyOf(Consumer...) but the given consumers can throw checked exceptions.
More precisely, RuntimeException and AssertionError are rethrown as they are and Throwable wrapped in a RuntimeException.
Overriding error message is not supported as it would prevent from
getting the error messages of the failing assertions, these are valuable to figure out what went wrong.
Describing the assertion is supported (for example with Descriptable.as(String, Object...)).
Example:
// read() throws IOException
ThrowingConsumer<Reader> hasReachedEOF = reader -> assertThat(reader.read()).isEqualTo(-1);
ThrowingConsumer<Reader> startsWithZ = reader -> assertThat(reader.read()).isEqualTo('Z');
// assertion succeeds as the file is empty (note that if hasReachedEOF was declared as a Consumer<Reader> the following line would not compile):
assertThat(new FileReader("empty.txt")).satisfiesAnyOf(hasReachedEOF, startsWithZ);
// alphabet.txt contains: abcdefghijklmnopqrstuvwxyz
// assertion fails as alphabet.txt is not empty and starts with 'a':
assertThat(new FileReader("alphabet.txt")).satisfiesAnyOf(hasReachedEOF, startsWithZ);assertions - the group of assertions to run against the object under test - must not be null.IllegalArgumentException - if any given assertions group is nullRuntimeException - rethrown as is by the given ThrowingConsumer or wrapping any Throwable.AssertionError - rethrown as is by the given ThrowingConsumerprotected SELF satisfiesAnyOfForProxy(Consumer<? super ACTUAL>[] assertionsGroups) throws AssertionError
AssertionErrorpublic static void setCustomRepresentation(Representation customRepresentation)
public static void setPrintAssertionsDescription(boolean printAssertionsDescription)
public static void setDescriptionConsumer(Consumer<Description> descriptionConsumer)
public SELF hasSameHashCodeAs(Object other)
Example:
// assertions succeed
assertThat(42L).hasSameHashCodeAs(42L);
assertThat("The Force").hasSameHashCodeAs("The Force");
assertThat(new Jedi("Yoda", "Blue")).hasSameHashCodeAs(new Jedi("Yoda", "Blue"));
// assertions fail
assertThat(42L).hasSameHashCodeAs(2501L);
assertThat(null).hasSameHashCodeAs("The Force");
assertThat("The Force").hasSameHashCodeAs("Awakens");hasSameHashCodeAs in interface Assert<SELF extends AbstractAssert<SELF,ACTUAL>,ACTUAL>other - the object to check hashCode against.public SELF doesNotHaveSameHashCodeAs(Object other)
Example:
// assertions succeed
assertThat(42L).doesNotHaveSameHashCodeAs(2501L);
assertThat("The Force").doesNotHaveSameHashCodeAs("Awakens");
// assertions fail
assertThat(42L).doesNotHaveSameHashCodeAs(42L);
assertThat("The Force").doesNotHaveSameHashCodeAs("The Force");
assertThat(new Jedi("Yoda", "Blue")).doesNotHaveSameHashCodeAs(new Jedi("Yoda", "Blue")); doesNotHaveSameHashCodeAs in interface Assert<SELF extends AbstractAssert<SELF,ACTUAL>,ACTUAL>other - the object to check hashCode against.protected <E> AbstractListAssert<?,List<? extends E>,E,ObjectAssert<E>> newListAssertInstance(List<? extends E> newActual)
AbstractListAssert from the given list.
this method avoids code duplication when features like extracting/asList need to create a new list assertions.
E - the type of elements.newActual - new list under testAbstractListAssert.protected RecursiveComparisonAssert<?> usingRecursiveComparison(RecursiveComparisonConfiguration recursiveComparisonConfiguration)
protected RecursiveComparisonAssert<?> usingRecursiveComparison()
protected <ASSERT extends AbstractAssert<?,?>> ASSERT extracting(String propertyOrField, AssertFactory<Object,ASSERT> assertFactory)
If the object under test is a Map, the propertyOrField parameter is used as a key to the map.
Nested field/property is supported, specifying "address.street.number" is equivalent to get the value corresponding to actual.getAddress().getStreet().getNumber()
Private field can be extracted unless you call Assertions.setAllowExtractingPrivateFields(false).
ASSERT - the type of the resulting AssertpropertyOrField - the property/field to extract from the initial object under testassertFactory - the factory for the creation of the new AssertAssert instanceAssertionError - if the object under test is nullAbstractObjectAssert.extracting(String),
AbstractObjectAssert.extracting(String, InstanceOfAssertFactory)protected <T,ASSERT extends AbstractAssert<?,?>> ASSERT extracting(Function<? super ACTUAL,? extends T> extractor, AssertFactory<T,ASSERT> assertFactory)
Function to extract a value from the object under test and creates a new assertion object
using the given assert factory.T - the expected extracted value typeASSERT - the type of the resulting Assertextractor - the extractor function used to extract the value from the object under testassertFactory - the factory for the creation of the new AssertAssert instanceAssertionError - if the object under test is nullAbstractObjectAssert.extracting(Function),
AbstractObjectAssert.extracting(Function, InstanceOfAssertFactory)@Deprecated protected boolean areEqual(Object actual, Object other)
ComparisonStrategy will become part of the public API in the next major release and this method
will be removed.actual - the object to compare to otherother - the object to compare to actualCopyright © 2025. All rights reserved.