Top Deprecated
AssertJ Core 3.26.0

Deprecated API


No API in this release is deprecated for removal.

Deprecated Item Summary

SinceDeprecated Item and Description

Returns:

true if actual and other are equal according to the underlying comparison strategy.
org.assertj.core.api.AbstractAssert.areEqual
(Object
the object to compare to other
actual
,
Object
the object to compare to actual
other
)

ComparisonStrategy will become part of the public API in the next major release and this method will be removed.

org.assertj.core.api.AbstractAssert.equals(Object
the reference object with which to compare.
obj
)

use isEqualTo instead

org.assertj.core.api.AbstractBooleanArrayAssert.usingDefaultElementComparator()

Custom element Comparator is not supported for Boolean array comparison.

org.assertj.core.api.AbstractBooleanArrayAssert.usingElementComparator(Comparator<? super Boolean>
the comparator to use for incoming assertion checks.
customComparator
)

Custom element Comparator is not supported for Boolean array comparison.

org.assertj.core.api.AbstractBooleanAssert.usingComparator(Comparator<? super Boolean>
the comparator to use for the incoming assertion checks.
customComparator
)

Custom Comparator is not supported for Boolean comparison.

org.assertj.core.api.AbstractBooleanAssert.usingComparator(Comparator<? super Boolean>
the comparator to use for the incoming assertion checks.
customComparator
,
String
comparator description to be used in assertion error messages
customComparatorDescription
)

Custom Comparator is not supported for Boolean comparison.

Returns:

a new StringAssert instance whose string under test is the result of the encoding.
org.assertj.core.api.AbstractByteArrayAssert.encodedAsBase64
()

use asBase64Encoded() instead.

Encodes the actual array into a Base64 string, the encoded string becoming the new object under test.

Examples:

 // assertion succeeds
assertThat("AssertJ".getBytes()).encodedAsBase64().isEqualTo("QXNzZXJ0Sg==");

Returns:

this assertion object.
org.assertj.core.api.AbstractCharSequenceAssert.isJavaBlank
()

Use isBlank() instead.

Returns:

this assertion object to chain other assertions.
org.assertj.core.api.AbstractCharSequenceAssert.isXmlEqualTo
(CharSequence
the XML CharSequence to which the actual CharSequence is to be compared to.
expectedXml
)

This assertion has some limitations, for example it does not handle tab vs space and would fail if elements are the same but in a different order.
The recommended approach is XML Unit which is able to deal with these limitations and provides many more features like XPath support and schema validation.

Original javadoc:

Verifies that the actual CharSequence is equal to the given XML CharSequence after both have been formatted the same way.

Example:

 String expectedXml =
    "<rings>\n" +
        "  <bearer>\n" +
        "    <name>Frodo</name>\n" +
        "    <ring>\n" +
        "      <name>one ring</name>\n" +
        "      <createdBy>Sauron</createdBy>\n" +
        "    </ring>\n" +
        "  </bearer>\n" +
        "</rings>";

// No matter how your xml string is formatted, isXmlEqualTo is able to compare it's content with another xml String.
String oneLineXml = "<rings><bearer><name>Frodo</name><ring><name>one ring</name><createdBy>Sauron</createdBy></ring></bearer></rings>";
assertThat(oneLineXml).isXmlEqualTo(expectedXml);

String xmlWithNewLine =
    "<rings>\n" +
        "<bearer>   \n" +
        "  <name>Frodo</name>\n" +
        "  <ring>\n" +
        "    <name>one ring</name>\n" +
        "    <createdBy>Sauron</createdBy>\n" +
        "  </ring>\n" +
        "</bearer>\n" +
        "</rings>";
assertThat(xmlWithNewLine).isXmlEqualTo(expectedXml);

// You can compare it with oneLineXml
assertThat(xmlWithNewLine).isXmlEqualTo(oneLineXml);

// Tip : use isXmlEqualToContentOf assertion to compare your XML String with the content of an XML file :
assertThat(oneLineXml).isXmlEqualToContentOf(new File("src/test/resources/formatted.xml"));

Returns:

this assertion object to chain other assertions.
org.assertj.core.api.AbstractCharSequenceAssert.isXmlEqualToContentOf
(File
the file to read the expected XML String to compare with actual CharSequence
xmlFile
)

org.assertj.core.api.AbstractCharSequenceAssert.usingDefaultElementComparator()

Custom element Comparator is not supported for CharSequence comparison.

org.assertj.core.api.AbstractCharSequenceAssert.usingElementComparator(Comparator<? super Character>
the comparator to use for incoming assertion checks.
customComparator
)

Custom element Comparator is not supported for CharSequence comparison.

Returns:

this assertions object
org.assertj.core.api.AbstractClassAssert.hasFields
(String...
the fields who must be in the class.
fields
)

use hasPublicFields(String...) instead.

Returns:

this assertion object.
org.assertj.core.api.AbstractCompletableFutureAssert.hasFailed
()

Combine isCompletedExceptionally with isNotCancelled instead:

 assertThat(future).isCompletedExceptionally()
                  .isNotCancelled();
This assertion is deprecated to change the semantics of failed to correspond to CompletableFuture#get() failing.

Original javadoc

Verifies that the CompletableFuture has completed exceptionally but has not been cancelled, this assertion is equivalent to:

 assertThat(future).isCompletedExceptionally()
                  .isNotCancelled();

Assertion will pass :

 CompletableFuture future = new CompletableFuture();
future.completeExceptionally(new RuntimeException());
assertThat(future).hasFailed();
Assertion will fail :
 CompletableFuture future = new CompletableFuture();
future.cancel(true);
assertThat(future).hasFailed();

Returns:

an exception assertion object.
org.assertj.core.api.AbstractCompletableFutureAssert.hasFailedWithThrowableThat
()

Although not 100% the same, consider using failsWithin(Duration) or failsWithin(long, TimeUnit) instead:

 CompletableFuture future = new CompletableFuture();
future.completeExceptionally(new RuntimeException("boom!"));

assertThat(future).failsWithin(1, TimeUnit.SECONDS)
                  .withThrowableOfType(RuntimeException.class)
                  .withMessage("boom!"); 
This assertion is deprecated because it relies on hasFailed() semantics which we want to move away from (they are not clear!) and to use failure semantics corresponding to CompletableFuture#get() failing.

Original javadoc

Verifies that the CompletableFuture has completed exceptionally and returns a Throwable assertion object allowing to check the Throwable that has caused the future to fail.

Assertion will pass :

 CompletableFuture future = new CompletableFuture();
future.completeExceptionally(new RuntimeException("boom!"));

assertThat(future).hasFailedWithThrowableThat().isInstanceOf(RuntimeException.class);
                                               .hasMessage("boom!"); 
Assertion will fail :
 CompletableFuture future = new CompletableFuture();
future.completeExceptionally(new RuntimeException());

assertThat(future).hasFailedWithThrowableThat().isInstanceOf(IllegalArgumentException.class);

Returns:

this assertion object.
org.assertj.core.api.AbstractCompletableFutureAssert.hasNotFailed
()

Use matches with the following combination instead:

 assertThat(future).matches (f -> f.isNotCompletedExceptionally() || f.isCancelled());
This assertion is deprecated because its semantic is not obvious.

Original javadoc

Verifies that the CompletableFuture has not failed i.e: incomplete, completed or cancelled.
This is different from isNotCompletedExceptionally() as a cancelled future has not failed but is completed exceptionally.

Assertion will pass :

 CompletableFuture future = new CompletableFuture();
future.cancel(true);
assertThat(future).hasNotFailed();
Assertion will fail :
 CompletableFuture future = new CompletableFuture();
future.completeExceptionally(new RuntimeException());
assertThat(future).hasNotFailed();

Returns:

this assertion object.
org.assertj.core.api.AbstractDateAssert.isAfterOrEqualsTo
(Date
the given Date.
other
)

prefer calling isAfterOrEqualTo(Date)

Returns:

this assertion object.
org.assertj.core.api.AbstractDateAssert.isAfterOrEqualsTo
(String
the given Date represented as String in default or custom date format.
dateAsString
)

prefer calling isAfterOrEqualTo(String)

Returns:

this assertion object.
org.assertj.core.api.AbstractDateAssert.isBeforeOrEqualsTo
(Date
the given Date.
other
)

prefer calling isBeforeOrEqualTo(Date)

Returns:

this assertion object.
org.assertj.core.api.AbstractDateAssert.isBeforeOrEqualsTo
(String
the given Date represented as String in default or custom date format.
dateAsString
)

prefer calling isBeforeOrEqualTo(String)

Returns:

this assertion object.
org.assertj.core.api.AbstractDateAssert.isEqualToIgnoringHours
(String
the given Date represented as String in default or custom date format.
dateAsString
)

Use isCloseTo(Date, long) instead, although not exactly the same semantics, this is the right way to compare with a given precision.

Returns:

this assertion object.
org.assertj.core.api.AbstractDateAssert.isEqualToIgnoringHours
(Instant
the given Instant.
instant
)

Use isCloseTo(Instant, long) instead, although not exactly the same semantics, this is the right way to compare with a given precision.

Returns:

this assertion object.
org.assertj.core.api.AbstractDateAssert.isEqualToIgnoringHours
(Date
the given Date.
date
)

Use isCloseTo(Date, long) instead, although not exactly the same semantics, this is the right way to compare with a given precision.

Returns:

this assertion object.
org.assertj.core.api.AbstractDateAssert.isEqualToIgnoringMillis
(String
the given Date represented as String in default or custom date format.
dateAsString
)

Use isCloseTo(Date, long) instead, although not exactly the same semantics, this is the right way to compare with a given precision.

Returns:

this assertion object.
org.assertj.core.api.AbstractDateAssert.isEqualToIgnoringMillis
(Instant
the given Instant.
instant
)

Use isCloseTo(Instant, long) instead, although not exactly the same semantics, this is the right way to compare with a given precision.

Returns:

this assertion object.
org.assertj.core.api.AbstractDateAssert.isEqualToIgnoringMillis
(Date
the given Date represented as String in default or custom date format.
date
)

Use isCloseTo(Date, long) instead, although not exactly the same semantics, this is the right way to compare with a given precision.

Returns:

this assertion object.
org.assertj.core.api.AbstractDateAssert.isEqualToIgnoringMinutes
(String
the given Date represented as String in default or custom date format.
dateAsString
)

Use isCloseTo(Date, long) instead, although not exactly the same semantics, this is the right way to compare with a given precision.

Returns:

this assertion object.
org.assertj.core.api.AbstractDateAssert.isEqualToIgnoringMinutes
(Instant
the given Instant.
instant
)

Use isCloseTo(Instant, long) instead, although not exactly the same semantics, this is the right way to compare with a given precision.

Returns:

this assertion object.
org.assertj.core.api.AbstractDateAssert.isEqualToIgnoringMinutes
(Date
the given Date.
date
)

Use isCloseTo(Date, long) instead, although not exactly the same semantics, this is the right way to compare with a given precision.

Returns:

this assertion object.
org.assertj.core.api.AbstractDateAssert.isEqualToIgnoringSeconds
(String
the given Date represented as String in default or custom date format.
dateAsString
)

Use isCloseTo(Date, long) instead, although not exactly the same semantics, this is the right way to compare with a given precision.

Returns:

this assertion object.
org.assertj.core.api.AbstractDateAssert.isEqualToIgnoringSeconds
(Instant
the given Instant.
instant
)

Use isCloseTo(Instant, long) instead, although not exactly the same semantics, this is the right way to compare with a given precision.

Returns:

this assertion object.
org.assertj.core.api.AbstractDateAssert.isEqualToIgnoringSeconds
(Date
the given Date represented as String in default or custom date format.
date
)

Use isCloseTo(Date, long) instead, although not exactly the same semantics, this is the right way to compare with a given precision.

Returns:

this assertion object.
org.assertj.core.api.AbstractDateAssert.isInSameHourAs
(Date
the given Date to compare actual Date to.
other
)

Use isCloseTo(Date, long) instead, although not exactly the same semantics, this is the right way to compare with a given precision.

Returns:

this assertion object.
org.assertj.core.api.AbstractDateAssert.isInSameHourAs
(String
the given Date represented as String in default or custom date format.
dateAsString
)

Use isCloseTo(Date, long) instead, although not exactly the same semantics, this is the right way to compare with a given precision.

Returns:

this assertion object.
org.assertj.core.api.AbstractDateAssert.isInSameMinuteAs
(Date
the given Date to compare actual Date to.
other
)

Use isCloseTo(Date, long) instead, although not exactly the same semantics, this is the right way to compare with a given precision.

Returns:

this assertion object.
org.assertj.core.api.AbstractDateAssert.isInSameMinuteAs
(String
the given Date represented as String in default or custom date format.
dateAsString
)

Use isCloseTo(Date, long) instead, although not exactly the same semantics, this is the right way to compare with a given precision.

Returns:

this assertion object.
org.assertj.core.api.AbstractDateAssert.isInSameSecondAs
(Date
the given Date to compare actual Date to.
other
)

Use isCloseTo(Date, long) instead, although not exactly the same semantics, this is the right way to compare with a given precision.

Returns:

this assertion object.
org.assertj.core.api.AbstractDateAssert.isInSameSecondAs
(String
the given Date represented as String.
dateAsString
)

Use isCloseTo(Date, long) instead, although not exactly the same semantics, this is the right way to compare with a given precision.

Returns:

this assertion object.
org.assertj.core.api.AbstractDateAssert.isWithinDayOfMonth
(int
the day of month to compare actual day of month to
dayOfMonth
)

use hasDayOfMonth(int) instead.

Returns:

this assertion object.
org.assertj.core.api.AbstractDateAssert.isWithinDayOfWeek
(int
the day of week to compare actual day of week to, see Calendar#DAY_OF_WEEK for valid values
dayOfWeek
)

use hasDayOfWeek(int) instead.

Returns:

this assertion object.
org.assertj.core.api.AbstractDateAssert.isWithinHourOfDay
(int
the hour of day to compare actual hour of day to (24-hour clock)
hourOfDay
)

use hasHourOfDay(int) instead.

Returns:

this assertion object.
org.assertj.core.api.AbstractDateAssert.isWithinMillisecond
(int
the millisecond to compare actual millisecond to
millisecond
)

use hasMillisecond(int) instead.

Returns:

this assertion object.
org.assertj.core.api.AbstractDateAssert.isWithinMinute
(int
the minute to compare actual minute to
minute
)

use hasMinute(int) instead.

Returns:

this assertion object.
org.assertj.core.api.AbstractDateAssert.isWithinMonth
(int
the month to compare actual month to, month value starting at 1 (January=1, February=2, ...).
month
)

use hasMonth(int) instead.

Returns:

this assertion object.
org.assertj.core.api.AbstractDateAssert.isWithinSecond
(int
the second to compare actual second to
second
)

use hasSecond(int) instead.

Returns:

this assertion object.
org.assertj.core.api.AbstractDateAssert.isWithinYear
(int
the year to compare actual year to
year
)

use hasYear(int) instead.

Returns:

this assertion object.
org.assertj.core.api.AbstractFileAssert.hasContentEqualTo
(File
the given File to compare the actual File to.
expected
)

use hasSameTextualContentAs(File) instead

Returns:

this assertion object.
org.assertj.core.api.AbstractFileAssert.hasSameContentAs
(File
the given File to compare the actual File to.
expected
)

use hasSameTextualContentAs(File) instead.

Verifies that the content of the actual File is equal to the content of the given one. The charset to use when reading the actual file can be provided with usingCharset(Charset) or usingCharset(String) prior to calling this method; if not, the platform's default charset (as returned by Charset#defaultCharset()) will be used. Examples:

 // use the default charset
File xFile = Files.write(Paths.get("xfile.txt"), "The Truth Is Out There".getBytes()).toFile();
File xFileClone = Files.write(Paths.get("xfile-clone.txt"), "The Truth Is Out There".getBytes()).toFile();
File xFileFrench = Files.write(Paths.get("xfile-french.txt"), "La Vérité Est Ailleurs".getBytes()).toFile();
// use UTF-8 charset
File xFileUTF8 = Files.write(Paths.get("xfile-clone.txt"), Arrays.asList("The Truth Is Out There"), StandardCharsets.UTF_8).toFile();

// The following assertion succeeds (default charset is used):
assertThat(xFile).hasSameContentAs(xFileClone);
// The following assertion succeeds (UTF-8 charset is used to read xFile):
assertThat(xFileUTF8).usingCharset("UTF-8").hasSameContentAs(xFileClone);

// The following assertion fails:
assertThat(xFile).hasSameContentAs(xFileFrench);

Returns:

this assertion object.
org.assertj.core.api.AbstractFileAssert.hasSameContentAs
(File
the given File to compare the actual File to.
expected
,
Charset
the Charset used to read the content of the expected file.
expectedCharset
)

use hasSameTextualContentAs(File, Charset) instead

Returns:

this assertion object.
org.assertj.core.api.AbstractInputStreamAssert.hasContentEqualTo
(InputStream
the given InputStream to compare the actual InputStream to.
expected
)

use hasSameContentAs(InputStream) instead

org.assertj.core.api.AbstractIterableAssert.containsOnlyElementsOf(Iterable<? extends ELEMENT>
the given Iterable we will get elements from.
iterable
)

org.assertj.core.api.AbstractIterableAssert.hasOnlyOneElementSatisfying(Consumer<? super ELEMENT>
the assertions to perform on the unique element.
elementAssertions
)

use singleElement() instead

Returns:

this assertion object.
org.assertj.core.api.AbstractIterableAssert.usingElementComparatorIgnoringFields
(String...
the field names to exclude in the elements comparison.
fields
)

This method is deprecated because it performs a shallow field by field comparison, i.e. elements are compared field by field but the fields are compared with equals, use usingRecursiveFieldByFieldElementComparatorIgnoringFields(String...) instead.
See https://assertj.github.io/doc/#assertj-core-recursive-comparison

Returns:

this assertion object.
org.assertj.core.api.AbstractIterableAssert.usingElementComparatorOnFields
(String...
the fields/properties to compare using element comparators
fields
)

This method is deprecated because it performs a shallow field by field comparison, i.e. elements are compared field by field but the fields are compared with equals, use usingRecursiveFieldByFieldElementComparatorOnFields(String...) instead.
See https://assertj.github.io/doc/#assertj-core-recursive-comparison

Returns:

this assertion object.
org.assertj.core.api.AbstractIterableAssert.usingFieldByFieldElementComparator
()

This method is deprecated because it performs a shallow field by field comparison, i.e. elements are compared field by field but the fields are compared with equals, use usingRecursiveFieldByFieldElementComparator() or usingRecursiveComparison() instead to perform a true recursive comparison.
See https://assertj.github.io/doc/#assertj-core-recursive-comparison

Returns:

this assertion object.
org.assertj.core.api.AbstractLocalDateTimeAssert.isEqualToIgnoringHours
(LocalDateTime
the given LocalDateTime.
other
)

Use isCloseTo(LocalDateTime, TemporalOffset) instead, although not exactly the same semantics, this is the right way to compare with a given precision.

Returns:

this assertion object.
org.assertj.core.api.AbstractLocalDateTimeAssert.isEqualToIgnoringMinutes
(LocalDateTime
the given LocalDateTime.
other
)

Use isCloseTo(LocalDateTime, TemporalOffset) instead, although not exactly the same semantics, this is the right way to compare with a given precision.

Returns:

this assertion object.
org.assertj.core.api.AbstractLocalDateTimeAssert.isEqualToIgnoringSeconds
(LocalDateTime
the given LocalDateTime.
other
)

Use isCloseTo(LocalDateTime, TemporalOffset) instead, although not exactly the same semantics, this is the right way to compare with a given precision.

Returns:

this assertion object.
org.assertj.core.api.AbstractLocalTimeAssert.isEqualToIgnoringNanos
(LocalTime
the given LocalTime.
other
)

Use isCloseTo(LocalTime, TemporalOffset) instead, although not exactly the same semantics, this is the right way to compare with a given precision.

Returns:

this assertion object.
org.assertj.core.api.AbstractLocalTimeAssert.isEqualToIgnoringSeconds
(LocalTime
the given LocalTime.
other
)

Use isCloseTo(LocalTime, TemporalOffset) instead, although not exactly the same semantics, this is the right way to compare with a given precision.

Returns:

a new assertion object whose object under test is the array containing the extracted map values
org.assertj.core.api.AbstractMapAssert.extracting
(Object...
the keys used to get values from the map under test
keys
)

use extractingByKeys(Object[]) instead

Returns:

a new ObjectAssert instance whose object under test is the extracted map value
org.assertj.core.api.AbstractMapAssert.extracting
(Object
the key used to get value from the map under test
key
)

use extractingByKey(Object) instead

org.assertj.core.api.AbstractMapAssert.usingDefaultElementComparator()

Custom element Comparator is not supported for MapEntry comparison.

org.assertj.core.api.AbstractMapAssert.usingElementComparator(Comparator<? super Map.Entry<? extends K, ? extends V>>
the comparator to use for incoming assertion checks.
customComparator
)

Custom element Comparator is not supported for MapEntry comparison.

Returns:

this assertion object.
org.assertj.core.api.AbstractObjectArrayAssert.usingElementComparatorIgnoringFields
(String...
the name of the fields to ignore
fields
)

This method is deprecated because it performs a shallow field by field comparison, i.e. elements are compared field by field but the fields are compared with equals, use usingRecursiveFieldByFieldElementComparatorIgnoringFields(String...) instead.
See https://assertj.github.io/doc/#assertj-core-recursive-comparison

Returns:

this assertion object.
org.assertj.core.api.AbstractObjectArrayAssert.usingElementComparatorOnFields
(String...
the name of the fields to use the element comparator on
fields
)

This method is deprecated because it performs a shallow field by field comparison, i.e. elements are compared field by field but the fields are compared with equals, use usingRecursiveFieldByFieldElementComparatorOnFields(String...) instead.
See https://assertj.github.io/doc/#assertj-core-recursive-comparison

Returns:

this assertion object.
org.assertj.core.api.AbstractObjectArrayAssert.usingFieldByFieldElementComparator
()

This method is deprecated because it performs a shallow field by field comparison, i.e. elements are compared field by field but the fields are compared with equals, use usingRecursiveFieldByFieldElementComparator() or usingRecursiveComparison() instead to perform a true recursive comparison.
See https://assertj.github.io/doc/#assertj-core-recursive-comparison

Returns:

this assertions object
org.assertj.core.api.AbstractObjectAssert.isEqualToComparingFieldByField
(Object
the object to compare actual to.
other
)

Use the recursive comparison by calling usingRecursiveComparison().

This method is deprecated because it only compares the first level of fields while the recursive comparison traverses all fields recursively (only stopping at java types).

For example suppose actual and expected are of type A which has the following structure:

 A
|— B b
|    |— String s
|    |— C c
|         |— String s
|         |— Date d
|— int i 
isEqualToComparingFieldByField will compare actual and expected A.b and A.i fields but not B fields (it calls B equals method instead comparing B fields).
The recursive comparison on the other hand will introspect B fields and then C fields and will compare actual and expected respective fields values, that is: A.i, A.B.s, A.B.C.s and A.B.C.d.

Concretely instead of writing:

 assertThat(actual).isEqualToComparingFieldByField(expected);
You should write:
 assertThat(actual).usingRecursiveComparison()
                  .isEqualTo(expected);
Original javadoc

Asserts that actual object is equal to the given object based on a property/field by property/field comparison (including inherited ones). This can be handy if equals implementation of objects to compare does not suit you.

Note that comparison is not recursive, if one of the field is an Object, it will be compared to the other field using its equals method.

If an object has a field and a property with the same name, the property value will be used over the field.

Private fields are used in comparison but this can be disabled using Assertions#setAllowComparingPrivateFields(boolean), if disabled only accessible fields values are compared, accessible fields include directly accessible fields (e.g. public) or fields with an accessible getter.

The objects to compare can be of different types but the properties/fields used in comparison must exist in both, for example if actual object has a name String field, it is expected the other object to also have one.

Example:

 // equals not overridden in TolkienCharacter
TolkienCharacter frodo = new TolkienCharacter("Frodo", 33, HOBBIT);
TolkienCharacter frodoClone = new TolkienCharacter("Frodo", 33, HOBBIT);

// Fail as equals compares object references
assertThat(frodo).isEqualTo(frodoClone);

// frodo and frodoClone are equals when doing a field by field comparison.
assertThat(frodo).isEqualToComparingFieldByField(frodoClone);

Returns:

this assertion object.
org.assertj.core.api.AbstractObjectAssert.isEqualToComparingFieldByFieldRecursively
(Object
the object to compare actual to.
other
)

Prefer calling usingRecursiveComparison() for comparing objects field by field as it offers more flexibility, better reporting and an easier to use API. Asserts that the object under test (actual) is equal to the given object based on a recursive property/field by property/field comparison (including inherited ones). This can be useful if actual's equals implementation does not suit you. The recursive property/field comparison is not applied on fields having a custom equals implementation, i.e. the overridden equals method will be used instead of a field by field comparison.

The recursive comparison handles cycles. By default floats are compared with a precision of 1.0E-6 and doubles with 1.0E-15.

You can specify a custom comparator per (nested) fields or type with respectively usingComparatorForFields(Comparator, String...) and usingComparatorForType(Comparator, Class).

The objects to compare can be of different types but must have the same properties/fields. For example if actual object has a name String field, it is expected the other object to also have one. If an object has a field and a property with the same name, the property value will be used over the field.

Example:

 public class Person {
  public String name;
  public double height;
  public Home home = new Home();
  public Person bestFriend;
  // constructor with name and height omitted for brevity
}

public class Home {
  public Address address = new Address();
}

public static class Address {
  public int number = 1;
}

Person jack = new Person("Jack", 1.80);
jack.home.address.number = 123;

Person jackClone = new Person("Jack", 1.80);
jackClone.home.address.number = 123;

// cycle are handled in comparison
jack.bestFriend = jackClone;
jackClone.bestFriend = jack;

// will fail as equals compares object references
assertThat(jack).isEqualTo(jackClone);

// jack and jackClone are equals when doing a recursive field by field comparison
assertThat(jack).isEqualToComparingFieldByFieldRecursively(jackClone);

// any type/field can be compared with a a specific comparator.
// let's change  jack's height a little bit
jack.height = 1.81;

// assertion fails because of the height difference
// (the default precision comparison for double is 1.0E-15)
assertThat(jack).isEqualToComparingFieldByFieldRecursively(jackClone);

// this succeeds because we allow a 0.5 tolerance on double
assertThat(jack).usingComparatorForType(new DoubleComparator(0.5), Double.class)
                .isEqualToComparingFieldByFieldRecursively(jackClone);

// you can set a comparator on specific fields (nested fields are supported)
assertThat(jack).usingComparatorForFields(new DoubleComparator(0.5), "height")
                .isEqualToComparingFieldByFieldRecursively(jackClone);

Returns:

this assertion object.
org.assertj.core.api.AbstractObjectAssert.isEqualToComparingOnlyGivenFields
(Object
the object to compare actual to.
other
,
String...
properties/fields used in comparison.
propertiesOrFieldsUsedInComparison
)

Use the recursive comparison by calling usingRecursiveComparison() and specify the fields to ignore.

Warning: the recursive comparison does not provide a strictly equivalent feature, instead it provides several ways to ignore fields in the comparison by specifying fields to ignore, or fields by type or fields matching regexes. The idea being that it is best to compare as many fields as possible and only ignore the ones that are not relevant (for example generated ids).

This method is deprecated because it only compares the first level of fields while the recursive comparison traverses all fields recursively (only stopping at java types).

For example suppose actual and expected are of type A which has the following structure:

 A
|— B b
|    |— String s
|    |— C c
|         |— String s
|         |— Date d
|— int i
isEqualToComparingOnlyGivenFields will compare actual and expected A.b and A.i fields but not B fields (it calls B equals method instead comparing B fields).
The recursive comparison on the other hand will introspect B fields and then C fields and will compare actual and expected respective fields values, that is: A.i, A.B.s, A.B.C.s and A.B.C.d.

Assuming actual has 4 fields f1, f2, f3, f4, instead of writing:

 assertThat(actual).isEqualToComparingOnlyGivenFields(expected, f1, f2);
You should write:
 assertThat(actual).usingRecursiveComparison()
                  .ignoringFields(f3, f4)
                  .isEqualTo(expected);
Original javadoc

Asserts that the actual object is equal to the given one using a property/field by property/field comparison on the given properties/fields only (fields can be inherited fields or nested fields). This can be handy if equals implementation of objects to compare does not suit you.

Note that comparison is not recursive, if one of the field is an Object, it will be compared to the other field using its equals method.

If an object has a field and a property with the same name, the property value will be used over the field.

Private fields are used in comparison but this can be disabled using Assertions#setAllowComparingPrivateFields(boolean), if disabled only accessible fields values are compared, accessible fields include directly accessible fields (e.g. public) or fields with an accessible getter.

The objects to compare can be of different types but the properties/fields used in comparison must exist in both, for example if actual object has a name String field, it is expected the other object to also have one.

Example:

 TolkienCharacter frodo = new TolkienCharacter("Frodo", 33, HOBBIT);
TolkienCharacter sam = new TolkienCharacter("Sam", 38, HOBBIT);

// frodo and sam both are hobbits, so they are equals when comparing only race
assertThat(frodo).isEqualToComparingOnlyGivenFields(sam, "race"); // OK

// they are also equals when comparing only race name (nested field).
assertThat(frodo).isEqualToComparingOnlyGivenFields(sam, "race.name"); // OK

// ... but not when comparing both name and race
assertThat(frodo).isEqualToComparingOnlyGivenFields(sam, "name", "race"); // FAIL

Returns:

this assertion object.
org.assertj.core.api.AbstractObjectAssert.isEqualToIgnoringGivenFields
(Object
the object to compare actual to.
other
,
String...
ignored properties/fields to ignore in comparison.
propertiesOrFieldsToIgnore
)

Use the recursive comparison by calling usingRecursiveComparison() and chain with ignoringFields(String...).

This method is deprecated because it only compares the first level of fields while the recursive comparison traverses all fields recursively (only stopping at java types).

For example suppose actual and expected are of type A which has the following structure:

 A
|— B b
|    |— String s
|    |— C c
|         |— String s
|         |— Date d
|— int i
isEqualToIgnoringGivenFields will compare actual and expected A.b and A.i fields but not B fields (it calls B equals method instead comparing B fields).
The recursive comparison on the other hand will introspect B fields and then C fields and will compare actual and expected respective fields values, that is: A.i, A.B.s, A.B.C.s and A.B.C.d.

Concretely instead of writing:

 assertThat(actual).isEqualToIgnoringGivenFields(expected, "i", "b.s");
You should write:
 assertThat(actual).usingRecursiveComparison()
                  .ignoringFields("i", "b.s")
                  .isEqualTo(expected);

Note that the recursive comparison also allows to ignore fields by type or matching regexes. Original javadoc

Asserts that the actual object is equal to the given one by comparing their properties/fields except for the given ones (inherited ones are taken into account). This can be handy if equals implementation of objects to compare does not suit you.

Note that comparison is not recursive, if one of the property/field is an Object, it will be compared to the other field using its equals method.

If an object has a field and a property with the same name, the property value will be used over the field.

Private fields are used in comparison but this can be disabled using Assertions#setAllowComparingPrivateFields(boolean), if disabled only accessible fields values are compared, accessible fields include directly accessible fields (e.g. public) or fields with an accessible getter.

The objects to compare can be of different types but the properties/fields used in comparison must exist in both, for example if actual object has a name String field, it is expected the other object to also have one.

Example:

 TolkienCharacter frodo = new TolkienCharacter("Frodo", 33, HOBBIT);
TolkienCharacter sam = new TolkienCharacter("Sam", 38, HOBBIT);

// frodo and sam are equals when ignoring name and age since the only remaining field is race which they share as HOBBIT.
assertThat(frodo).isEqualToIgnoringGivenFields(sam, "name", "age"); // OK

// ... but they are not equals if only age is ignored as their names differ.
assertThat(frodo).isEqualToIgnoringGivenFields(sam, "age"); // FAIL

Returns:

this assertion object.
org.assertj.core.api.AbstractObjectAssert.isEqualToIgnoringNullFields
(Object
the object to compare actual to.
other
)

Use the recursive comparison by calling usingRecursiveComparison() and chain with ignoringExpectedNullFields().

This method is deprecated because it only compares the first level of fields while the recursive comparison traverses all fields recursively (only stopping at java types).

For example suppose actual and expected are of type A which has the following structure:

 A
|— B b
|    |— String s
|    |— C c
|         |— String s
|         |— Date d
|— int i
isEqualToIgnoringNullFields will compare actual and expected A.b and A.i fields but not B fields (it calls B equals method instead comparing B fields).
The recursive comparison on the other hand will introspect B fields and then C fields and will compare actual and expected respective fields values, that is: A.i, A.B.s, A.B.C.s and A.B.C.d.

Concretely instead of writing:

 assertThat(actual).isEqualToIgnoringNullFields(expected);
You should write:
 assertThat(actual).usingRecursiveComparison()
                  .ignoringExpectedNullFields()
                  .isEqualTo(expected);

Note that the recursive comparison also allows to ignore actual's null fields with ignoringActualNullFields(). Original javadoc

Asserts that the actual object is equal to the given one by comparing actual's properties/fields with other's not null properties/fields only (including inherited ones).

It means that if an actual field is not null and the corresponding field in other is null, this field will be ignored in comparison, but the opposite will make assertion fail (null field in actual, not null in other) as the field is used in the performed comparison and the values differ.

Note that comparison is not recursive, if one of the field is an Object, it will be compared to the other field using its equals method.

If an object has a field and a property with the same name, the property value will be used over the field.

Private fields are used in comparison but this can be disabled using Assertions#setAllowComparingPrivateFields(boolean), if disabled only accessible fields values are compared, accessible fields include directly accessible fields (e.g. public) or fields with an accessible getter.

The objects to compare can be of different types but the properties/fields used in comparison must exist in both, for example if actual object has a name String field, it is expected other object to also have one.

Example:

 TolkienCharacter frodo = new TolkienCharacter("Frodo", 33, HOBBIT);
TolkienCharacter mysteriousHobbit = new TolkienCharacter(null, 33, HOBBIT);

// Null fields in other/expected object are ignored, the mysteriousHobbit has null name thus name is ignored
assertThat(frodo).isEqualToIgnoringNullFields(mysteriousHobbit); // OK

// ... but this is not reversible !
assertThat(mysteriousHobbit).isEqualToIgnoringNullFields(frodo); // FAIL

Returns:

this assertion object.
org.assertj.core.api.AbstractOffsetDateTimeAssert.isEqualToIgnoringHours
(OffsetDateTime other)

Use isCloseTo(OffsetDateTime, TemporalOffset) instead, although not exactly the same semantics, this is the right way to compare with a given precision.

Returns:

this assertion object.
org.assertj.core.api.AbstractOffsetDateTimeAssert.isEqualToIgnoringMinutes
(OffsetDateTime other)

Use isCloseTo(OffsetDateTime, TemporalOffset) instead, although not exactly the same semantics, this is the right way to compare with a given precision.

Returns:

this assertion object.
org.assertj.core.api.AbstractOffsetDateTimeAssert.isEqualToIgnoringNanos
(OffsetDateTime other)

Use isCloseTo(OffsetDateTime, TemporalOffset) instead, although not exactly the same semantics, this is the right way to compare with a given precision.

Returns:

this assertion object.
org.assertj.core.api.AbstractOffsetDateTimeAssert.isEqualToIgnoringSeconds
(OffsetDateTime other)

Use isCloseTo(OffsetDateTime, TemporalOffset) instead, although not exactly the same semantics, this is the right way to compare with a given precision.

Returns:

this assertion object.
org.assertj.core.api.AbstractOffsetTimeAssert.isEqualToIgnoringNanos
(OffsetTime other)

Use isCloseTo(OffsetTime, TemporalOffset) instead, although not exactly the same semantics, this is the right way to compare with a given precision.

Returns:

this assertion object.
org.assertj.core.api.AbstractOffsetTimeAssert.isEqualToIgnoringSeconds
(OffsetTime other)

Use isCloseTo(OffsetTime, TemporalOffset) instead, although not exactly the same semantics, this is the right way to compare with a given precision.

Returns:

this assertion object.
org.assertj.core.api.AbstractOptionalAssert.usingFieldByFieldValueComparator
()

This method is deprecated because it performs a shallow field by field comparison, i.e. elements are compared field by field but the fields are compared with equals, use get() chained with AbstractObjectAssert#usingRecursiveComparison() instead.

 TolkienCharacter frodo = new TolkienCharacter("Frodo", 33, HOBBIT);
TolkienCharacter frodoClone = new TolkienCharacter("Frodo", 33, HOBBIT);

// frodo and frodoClone are equals when doing a field by field comparison.
assertThat(Optional.of(frodo)).get().usingRecursiveComparison()
                              .isEqualTo(frodoClone);

See https://assertj.github.io/doc/#assertj-core-recursive-comparison

Returns:

this assertion object.
org.assertj.core.api.AbstractPathAssert.hasSameContentAs
(Path
the given Path to compare the actual Path to.
expected
)

use hasSameTextualContentAs(Path) instead

Verifies that the content of the actual Path is the same as the given one (both paths must be a readable files). The charset to use when reading the actual path can be provided with usingCharset(Charset) or usingCharset(String) prior to calling this method; if not, the platform's default charset (as returned by Charset#defaultCharset()) will be used. Examples:

 // use the default charset
Path xFile = Files.write(Paths.get("xfile.txt"), "The Truth Is Out There".getBytes());
Path xFileUTF8 = Files.write(Paths.get("xfile-clone.txt"), "The Truth Is Out There".getBytes("UTF-8"));
Path xFileClone = Files.write(Paths.get("xfile-clone.txt"), "The Truth Is Out There".getBytes());
Path xFileFrench = Files.write(Paths.get("xfile-french.txt"), "La Vérité Est Ailleurs".getBytes());

// The following assertion succeeds (default charset is used):
assertThat(xFile).hasSameContentAs(xFileClone);
// The following assertion succeeds (UTF-8 charset is used to read xFile):
assertThat(xFileUTF8).usingCharset("UTF-8").hasContent(xFileClone);

// The following assertion fails:
assertThat(xFile).hasSameContentAs(xFileFrench);

Returns:

this assertion object.
org.assertj.core.api.AbstractPathAssert.hasSameContentAs
(Path
the given Path to compare the actual Path to.
expected
,
Charset
the Charset used to read the content of the expected Path.
expectedCharset
)

use hasSameTextualContentAs(Path, Charset) instead

Verifies that the content of the actual Path is the same as the expected one, the expected Path being read with the given charset while the charset used to read the actual path can be provided with usingCharset(Charset) or usingCharset(String) prior to calling this method; if not, the platform's default charset (as returned by Charset#defaultCharset()) will be used.

Examples:

 Path fileUTF8Charset = Files.write(Paths.get("actual"), Collections.singleton("Gerçek"), StandardCharsets.UTF_8);
Charset turkishCharset = Charset.forName("windows-1254");
Path fileTurkischCharset = Files.write(Paths.get("expected"), Collections.singleton("Gerçek"), turkishCharset);

// The following assertion succeeds:
assertThat(fileUTF8Charset).usingCharset(StandardCharsets.UTF_8).hasSameContentAs(fileTurkischCharset, turkishCharset);

// The following assertion fails:
assertThat(fileUTF8Charset).usingCharset(StandardCharsets.UTF_8).hasSameContentAs(fileTurkischCharset, StandardCharsets.UTF_8);

Returns:

a new ByteArrayAssert instance whose array under test is the result of the decoding.
org.assertj.core.api.AbstractStringAssert.decodedAsBase64
()

use asBase64Decoded() instead.

Decodes the actual value as a Base64 encoded string, the decoded bytes becoming the new array under test.

Examples:

 // assertion succeeds
assertThat("QXNzZXJ0Sg==").decodedAsBase64().containsExactly("AssertJ".getBytes());

// assertion succeeds even without padding as it is optional by specification
assertThat("QXNzZXJ0Sg").decodedAsBase64().containsExactly("AssertJ".getBytes());

// assertion fails as it has invalid Base64 characters
assertThat("inv@lid").decodedAsBase64();

Returns:

a new assertion object
org.assertj.core.api.AbstractThrowableAssert.getCause
()

use cause() instead.

Returns a new assertion object that uses the cause of the current Throwable as the actual Throwable under test.

Examples:

 Throwable cause =  new IllegalArgumentException("wrong amount 123");
Throwable exception = new Exception("boom!", cause);

// typical use:
assertThat(throwableWithMessage).getCause()
                                .hasMessageStartingWith("wrong amount");

Returns:

a new assertion object
org.assertj.core.api.AbstractThrowableAssert.getRootCause
()

use rootCause() instead.

Returns a new assertion object that uses the root cause of the current Throwable as the actual Throwable under test.

Examples:

 Throwable rootCause =  new JdbcException("invalid query");
Throwable cause =  new RuntimeException(rootCause);
Throwable exception = new Exception("boom!", cause);

// typical use:
assertThat(throwableWithMessage).getRootCause()
                                .hasMessageStartingWith("invalid");

Returns:

this assertion object.
org.assertj.core.api.AbstractZonedDateTimeAssert.isEqualToIgnoringHours
(ZonedDateTime
the given ZonedDateTime.
other
)

Use isCloseTo(ZonedDateTime, TemporalOffset) instead, although not exactly the same semantics, this is the right way to compare with a given precision.

Returns:

this assertion object.
org.assertj.core.api.AbstractZonedDateTimeAssert.isEqualToIgnoringMinutes
(ZonedDateTime
the given ZonedDateTime.
other
)

Use isCloseTo(ZonedDateTime, TemporalOffset) instead, although not exactly the same semantics, this is the right way to compare with a given precision.

Returns:

this assertion object.
org.assertj.core.api.AbstractZonedDateTimeAssert.isEqualToIgnoringNanos
(ZonedDateTime
the given ZonedDateTime.
other
)

Use isCloseTo(ZonedDateTime, TemporalOffset) instead, although not exactly the same semantics, this is the right way to compare with a given precision.

Returns:

this assertion object.
org.assertj.core.api.AbstractZonedDateTimeAssert.isEqualToIgnoringSeconds
(ZonedDateTime
the given ZonedDateTime.
other
)

Use isCloseTo(ZonedDateTime, TemporalOffset) instead, although not exactly the same semantics, this is the right way to compare with a given precision.

org.assertj.core.api.Assert.equals(Object obj)

Throws UnsupportedOperationException if called. It is easy to accidentally call equals(Object) instead of isEqualTo(Object).

Returns:

the created assertion object.
org.assertj.core.api.Assertions.assertThat
(Iterable<? extends ELEMENT>
the actual value.
actual
,
AssertFactory<ELEMENT, ELEMENT_ASSERT>
the factory used to create the elements assert instance.
assertFactory
)

This was added to help creating type-specific assertions for the elements of an Iterable instance.

Deprecated way:

 Iterable<String> hobbits = Set.of("frodo", "sam", "Pippin");
assertThat(hobbits, StringAssert::new).first()
                                      .startsWith("fro")
                                      .endsWith("do");
However, there is a better way with InstanceOfAssertFactory and the corresponding first(InstanceOfAssertFactory).

New way:

 assertThat(hobbits).first(STRING) // static import of InstanceOfAssertFactories.STRING
                   .startsWith("fro")
                   .endsWith("do");
The main advantage of the latter is easier discoverability and the use of InstanceOfAssertFactory which is the preferred way to create type-specific assertions in AssertJ API.

Returns:

the created assertion object.
org.assertj.core.api.Assertions.assertThat
(ACTUAL
the actual value.
actual
,
Class<ELEMENT_ASSERT>
the class used to create the elements assert instance.
assertClass
)

This was added to help creating type-specific assertions for the elements of an Iterable instance.

Deprecated way:

 Iterable<String> hobbits = Set.of("frodo", "sam", "Pippin");
assertThat(hobbits, StringAssert.class).first()
                                       .startsWith("fro")
                                       .endsWith("do");
However, there is a better way with InstanceOfAssertFactory and the corresponding first(InstanceOfAssertFactory).

New way:

 assertThat(hobbits).first(STRING) // static import of InstanceOfAssertFactories.STRING
                   .startsWith("fro")
                   .endsWith("do");
The main advantage of the latter is easier discoverability and the use of InstanceOfAssertFactory which is the preferred way to create type-specific assertions in AssertJ API.

Returns:

the created assertion object.
org.assertj.core.api.Assertions.assertThat
(List<? extends ELEMENT>
the actual value.
actual
,
AssertFactory<ELEMENT, ELEMENT_ASSERT>
the factory used to create the elements assert instance.
assertFactory
)

This was added to help creating type-specific assertions for the elements of an List instance.

Deprecated way:

 List<String> hobbits = List.of("frodo", "sam", "Pippin");
assertThat(hobbits, StringAssert::new).first()
                                      .startsWith("fro")
                                      .endsWith("do");
However, there is a better way with InstanceOfAssertFactory and the corresponding first(InstanceOfAssertFactory).

New way:

 assertThat(hobbits).first(STRING) // static import of InstanceOfAssertFactories.STRING
                   .startsWith("fro")
                   .endsWith("do");
The main advantage of the latter is easier discoverability and the use of InstanceOfAssertFactory which is the preferred way to create type-specific assertions in AssertJ API.

Returns:

the created assertion object.
org.assertj.core.api.Assertions.assertThat
(List<? extends ELEMENT>
the actual value.
actual
,
Class<ELEMENT_ASSERT>
the class used to create the elements assert instance.
assertClass
)

This was added to help creating type-specific assertions for the elements of an List instance.

Deprecated way:

 List<String> hobbits = List.of("frodo", "sam", "Pippin");
assertThat(hobbits, StringAssert.class).first()
                                       .startsWith("fro")
                                       .endsWith("do");
However, there is a better way with InstanceOfAssertFactory and the corresponding first(InstanceOfAssertFactory).

New way:

 assertThat(hobbits).first(STRING) // static import of InstanceOfAssertFactories.STRING
                   .startsWith("fro")
                   .endsWith("do");
The main advantage of the latter is easier discoverability and the use of InstanceOfAssertFactory which is the preferred way to create type-specific assertions in AssertJ API.

Returns:

The captured exception or null if none was raised by the callable.
org.assertj.core.api.Assertions.catchThrowableOfType
(ThrowableAssert.ThrowingCallable
The lambda with the code that should raise the exception.
shouldRaiseThrowable
,
Class<THROWABLE>
The type of exception that the code is expected to raise.
type
)

use catchThrowableOfType(Class, ThrowingCallable) instead.

Returns:

The captured exception or null if none was raised by the callable.
org.assertj.core.api.AssertionsForClassTypes.catchThrowableOfType
(ThrowableAssert.ThrowingCallable
The lambda with the code that should raise the exception.
shouldRaiseThrowable
,
Class<THROWABLE>
The type of exception that the code is expected to raise.
type
)

use catchThrowableOfType(Class, ThrowingCallable) instead.

Returns:

the created assertion object.
org.assertj.core.api.AssertionsForInterfaceTypes.assertThat
(Iterable<? extends ELEMENT>
the actual value.
actual
,
AssertFactory<ELEMENT, ELEMENT_ASSERT>
the factory used to create the elements assert instance.
assertFactory
)

This was added to help creating type-specific assertions for the elements of an Iterable instance.

Deprecated way:

 Iterable<String> hobbits = Set.of("frodo", "sam", "Pippin");
assertThat(hobbits, StringAssert::new).first()
                                      .startsWith("fro")
                                      .endsWith("do");
However, there is a better way with InstanceOfAssertFactory and the corresponding first(InstanceOfAssertFactory).

New way:

 assertThat(hobbits).first(STRING) // static import of InstanceOfAssertFactories.STRING
                   .startsWith("fro")
                   .endsWith("do");
The main advantage of the latter is easier discoverability and the use of InstanceOfAssertFactory which is the preferred way to create type-specific assertions in AssertJ API.
org.assertj.core.api.AssertionsForInterfaceTypes.assertThat(ACTUAL actual, Class<ELEMENT_ASSERT> assertClass)

This was added to help creating type-specific assertions for the elements of an Iterable instance.

Deprecated way:

 Iterable<String> hobbits = Set.of("frodo", "sam", "Pippin");
assertThat(hobbits, StringAssert.class).first()
                                       .startsWith("fro")
                                       .endsWith("do");
However, there is a better way with InstanceOfAssertFactory and the corresponding first(InstanceOfAssertFactory).

New way:

 assertThat(hobbits).first(STRING) // static import of InstanceOfAssertFactories.STRING
                   .startsWith("fro")
                   .endsWith("do");
The main advantage of the latter is easier discoverability and the use of InstanceOfAssertFactory which is the preferred way to create type-specific assertions in AssertJ API.
org.assertj.core.api.AssertionsForInterfaceTypes.assertThat(List<? extends ELEMENT> actual, AssertFactory<ELEMENT, ELEMENT_ASSERT> assertFactory)

This was added to help creating type-specific assertions for the elements of an Iterable instance.

Deprecated way:

 List<String> hobbits = List.of("frodo", "sam", "Pippin");
assertThat(hobbits, StringAssert::new).first()
                                      .startsWith("fro")
                                      .endsWith("do");
However, there is a better way with InstanceOfAssertFactory and the corresponding first(InstanceOfAssertFactory).

New way:

 assertThat(hobbits).first(STRING) // static import of InstanceOfAssertFactories.STRING
                   .startsWith("fro")
                   .endsWith("do");
The main advantage of the latter is easier discoverability and the use of InstanceOfAssertFactory which is the preferred way to create type-specific assertions in AssertJ API.
org.assertj.core.api.AssertionsForInterfaceTypes.assertThat(List<? extends ELEMENT> actual, Class<ELEMENT_ASSERT> assertClass)

This was added to help creating type-specific assertions for the elements of an List instance.

Deprecated way:

 List<String> hobbits = List.of("frodo", "sam", "Pippin");
assertThat(hobbits, StringAssert.class).first()
                                       .startsWith("fro")
                                       .endsWith("do");
However, there is a better way with InstanceOfAssertFactory and the corresponding first(InstanceOfAssertFactory).

New way:

 assertThat(hobbits).first(STRING) // static import of InstanceOfAssertFactories.STRING
                   .startsWith("fro")
                   .endsWith("do");
The main advantage of the latter is easier discoverability and the use of InstanceOfAssertFactory which is the preferred way to create type-specific assertions in AssertJ API.
org.assertj.core.api.AtomicBooleanAssert.usingComparator(Comparator<? super AtomicBoolean>
the comparator to use for the incoming assertion checks.
customComparator
)

Custom Comparator is not supported for Boolean comparison.

org.assertj.core.api.AtomicBooleanAssert.usingComparator(Comparator<? super AtomicBoolean>
the comparator to use for the incoming assertion checks.
customComparator
,
String
comparator description to be used in assertion error messages
customComparatorDescription
)

Custom Comparator is not supported for Boolean comparison.

Returns:

this assertion object.
org.assertj.core.api.AtomicReferenceArrayAssert.usingElementComparatorIgnoringFields
(String...
the names of the fields/properties to ignore
fields
)

This method is deprecated because it performs a shallow field by field comparison, i.e. elements are compared field by field but the fields are compared with equals, use usingRecursiveFieldByFieldElementComparatorIgnoringFields(String...) instead.
See https://assertj.github.io/doc/#assertj-core-recursive-comparison

Returns:

this assertion object.
org.assertj.core.api.AtomicReferenceArrayAssert.usingElementComparatorOnFields
(String...
the fields to compare field/property by field/property.
fields
)

This method is deprecated because it performs a shallow field by field comparison, i.e. elements are compared field by field but the fields are compared with equals, use usingRecursiveFieldByFieldElementComparatorOnFields(String...) instead.
See https://assertj.github.io/doc/#assertj-core-recursive-comparison

Returns:

this assertion object.
org.assertj.core.api.AtomicReferenceArrayAssert.usingFieldByFieldElementComparator
()

This method is deprecated because it performs a shallow field by field comparison, i.e. elements are compared field by field but the fields are compared with equals, use usingRecursiveFieldByFieldElementComparator() or usingRecursiveComparison() instead to perform a true recursive comparison.
See https://assertj.github.io/doc/#assertj-core-recursive-comparison

Returns:

The captured exception or null if none was raised by the callable.
org.assertj.core.api.BDDAssertions.catchThrowableOfType
(ThrowableAssert.ThrowingCallable
The lambda with the code that should raise the exception.
throwingCallable
,
Class<THROWABLE>
The type of exception that the code is expected to raise.
type
)

use catchThrowableOfType(Class, ThrowingCallable) instead.

Returns:

the created assertion object.
org.assertj.core.api.BDDAssertions.then
(Iterable<? extends ELEMENT>
the actual value.
actual
,
AssertFactory<ELEMENT, ELEMENT_ASSERT>
the factory used to create the elements assert instance.
assertFactory
)

This was added to help creating type-specific assertions for the elements of an Iterable instance.

Deprecated way:

 Iterable<String> hobbits = Set.of("frodo", "sam", "Pippin");
then(hobbits, StringAssert::new).first()
                                .startsWith("fro")
                                .endsWith("do");
However, there is a better way with InstanceOfAssertFactory and the corresponding first(InstanceOfAssertFactory).

New way:

 then(hobbits).first(STRING) // static import of InstanceOfAssertFactories.STRING
             .startsWith("fro")
             .endsWith("do");
The main advantage of the latter is easier discoverability and the use of InstanceOfAssertFactory which is the preferred way to create type-specific assertions in AssertJ API.

Returns:

the created assertion object.
org.assertj.core.api.BDDAssertions.then
(ACTUAL
the actual value.
actual
,
Class<ELEMENT_ASSERT>
the class used to create the elements assert instance.
assertClass
)

This was added to help creating type-specific assertions for the elements of an Iterable instance.

Deprecated way:

 Iterable<String> hobbits = Set.of("frodo", "sam", "Pippin");
then(hobbits, StringAssert.class).first()
                                 .startsWith("fro")
                                 .endsWith("do");
However, there is a better way with InstanceOfAssertFactory and the corresponding first(InstanceOfAssertFactory).

New way:

 then(hobbits).first(STRING) // static import of InstanceOfAssertFactories.STRING
             .startsWith("fro")
             .endsWith("do");
The main advantage of the latter is easier discoverability and the use of InstanceOfAssertFactory which is the preferred way to create type-specific assertions in AssertJ API.

Returns:

the created assertion object.
org.assertj.core.api.BDDAssertions.then
(List<? extends ELEMENT>
the actual value.
actual
,
AssertFactory<ELEMENT, ELEMENT_ASSERT>
the factory used to create the elements assert instance.
assertFactory
)

This was added to help creating type-specific assertions for the elements of an List instance.

Deprecated way:

 List<String> hobbits = List.of("frodo", "sam", "Pippin");
then(hobbits, StringAssert::new).first()
                                .startsWith("fro")
                                .endsWith("do");
However, there is a better way with InstanceOfAssertFactory and the corresponding first(InstanceOfAssertFactory).

New way:

 then(hobbits).first(STRING) // static import of InstanceOfAssertFactories.STRING
             .startsWith("fro")
             .endsWith("do");
The main advantage of the latter is easier discoverability and the use of InstanceOfAssertFactory which is the preferred way to create type-specific assertions in AssertJ API.

Returns:

the created assertion object.
org.assertj.core.api.BDDAssertions.then
(List<? extends ELEMENT>
the actual value.
actual
,
Class<ELEMENT_ASSERT>
the class used to create the elements assert instance.
assertClass
)

This was added to help creating type-specific assertions for the elements of an Iterable instance.

Deprecated way:

 List<String> hobbits = List.of("frodo", "sam", "Pippin");
then(hobbits, StringAssert.class).first()
                                 .startsWith("fro")
                                 .endsWith("do");
However, there is a better way with InstanceOfAssertFactory and the corresponding first(InstanceOfAssertFactory).

New way:

 then(hobbits).first(STRING) // static import of InstanceOfAssertFactories.STRING
             .startsWith("fro")
             .endsWith("do");
The main advantage of the latter is easier discoverability and the use of InstanceOfAssertFactory which is the preferred way to create type-specific assertions in AssertJ API.
org.assertj.core.api.ClassBasedNavigableIterableAssert.assertThat(ACTUAL actual, Class<ELEMENT_ASSERT> assertClass)

This was added to help creating type-specific assertions for the elements of an Iterable instance.

Deprecated way:

 Iterable<String> hobbits = Set.of("frodo", "sam", "Pippin");
assertThat(hobbits, StringAssert.class).first()
                                       .startsWith("fro")
                                       .endsWith("do");
However, there is a better way with InstanceOfAssertFactory and the corresponding first(InstanceOfAssertFactory).

New way:

 assertThat(hobbits).first(STRING) // static import of InstanceOfAssertFactories.STRING
                   .startsWith("fro")
                   .endsWith("do");
The main advantage of the latter is easier discoverability and the use of InstanceOfAssertFactory which is the preferred way to create type-specific assertions in AssertJ API.
org.assertj.core.api.ClassBasedNavigableListAssert.assertThat(List<? extends ELEMENT> actual, Class<ELEMENT_ASSERT> assertClass)

This was added to help creating type-specific assertions for the elements of an List instance.

Deprecated way:

 List<String> hobbits = List.of("frodo", "sam", "Pippin");
assertThat(hobbits, StringAssert.class).first()
                                       .startsWith("fro")
                                       .endsWith("do");
However, there is a better way with InstanceOfAssertFactory and the corresponding first(InstanceOfAssertFactory).

New way:

 assertThat(hobbits).first(STRING) // static import of InstanceOfAssertFactories.STRING
                   .startsWith("fro")
                   .endsWith("do");
The main advantage of the latter is easier discoverability and the use of InstanceOfAssertFactory which is the preferred way to create type-specific assertions in AssertJ API.
org.assertj.core.api.FactoryBasedNavigableIterableAssert.assertThat(Iterable<? extends ELEMENT> actual, AssertFactory<ELEMENT, ELEMENT_ASSERT> assertFactory)

This was added to help creating type-specific assertions for the elements of an Iterable instance.

Deprecated way:

 Iterable<String> hobbits = Set.of("frodo", "sam", "Pippin");
assertThat(hobbits, StringAssert::new).first()
                                      .startsWith("fro")
                                      .endsWith("do");
However, there is a better way with InstanceOfAssertFactory and the corresponding first(InstanceOfAssertFactory).

New way:

 assertThat(hobbits).first(STRING) // static import of InstanceOfAssertFactories.STRING
                   .startsWith("fro")
                   .endsWith("do");
The main advantage of the latter is easier discoverability and the use of InstanceOfAssertFactory which is the preferred way to create type-specific assertions in AssertJ API.
org.assertj.core.api.FactoryBasedNavigableListAssert.assertThat(List<? extends ELEMENT> actual, AssertFactory<ELEMENT, ELEMENT_ASSERT> assertFactory)

org.assertj.core.api.JUnitJupiterBDDSoftAssertions

use SoftAssertionsExtension instead. Same as SoftAssertions, but with the following differences:
First, it's a JUnit Jupiter extension, which can be used without having to call assertAll(), example:

 public class SoftlyTest {

    @RegisterExtension
    public final JUnitJupiterBDDSoftAssertions softly = new JUnitJupiterBDDSoftAssertions();

    @Test
    public void soft_bdd_assertions() throws Exception {
      softly.then(1).isEqualTo(2);
      softly.then(Lists.newArrayList(1, 2)).containsOnly(1, 2);
    }
 }
Second, the failures are recognized by IDE's (like IntelliJ IDEA) which open a comparison window.
org.assertj.core.api.JUnitJupiterSoftAssertions

use SoftAssertionsExtension instead. Same as SoftAssertions, but with the following differences:
First, it's a JUnit Jupiter extension, which can be used without having to call assertAll(), example:

 public class SoftlyTest {

    @RegisterExtension
    public final JUnitJupiterSoftAssertions softly = new JUnitJupiterSoftAssertions();

    @Test
    public void testSoftly() throws Exception {
      softly.assertThat(1).isEqualTo(2);
      softly.assertThat(Lists.newArrayList(1, 2)).containsOnly(1, 2);
    }
 }
Second, the failures are recognized by IDE's (like IntelliJ IDEA) which open a comparison window.
org.assertj.core.api.Java6Assertions

For Android compatible assertions use the latest assertj 2.x version which is based on Java 7 only.

Assertions compatible with Android. Duplicated from Assertions.

Returns:

the created assertion object.
org.assertj.core.api.Java6Assertions.assertThat
(Iterable<? extends ELEMENT>
the actual value.
actual
,
AssertFactory<ELEMENT, ELEMENT_ASSERT>
the factory used to create the elements assert instance.
assertFactory
)

This was added to help creating type-specific assertions for the elements of an Iterable instance.

Deprecated way:

 Iterable<String> hobbits = Set.of("frodo", "sam", "Pippin");
assertThat(hobbits, StringAssert::new).first()
                                      .startsWith("fro")
                                      .endsWith("do");
However, there is a better way with InstanceOfAssertFactory and the corresponding first(InstanceOfAssertFactory).

New way:

 assertThat(hobbits).first(STRING) // static import of InstanceOfAssertFactories.STRING
                   .startsWith("fro")
                   .endsWith("do");
The main advantage of the latter is easier discoverability and the use of InstanceOfAssertFactory which is the preferred way to create type-specific assertions in AssertJ API.

Returns:

the created assertion object.
org.assertj.core.api.Java6Assertions.assertThat
(ACTUAL
the actual value.
actual
,
Class<ELEMENT_ASSERT>
the class used to create the elements assert instance.
assertClass
)

This was added to help creating type-specific assertions for the elements of an Iterable instance.

Deprecated way:

 Iterable<String> hobbits = Set.of("frodo", "sam", "Pippin");
assertThat(hobbits, StringAssert.class).first()
                                       .startsWith("fro")
                                       .endsWith("do");
However, there is a better way with InstanceOfAssertFactory and the corresponding first(InstanceOfAssertFactory).

New way:

 assertThat(hobbits).first(STRING) // static import of InstanceOfAssertFactories.STRING
                   .startsWith("fro")
                   .endsWith("do");
The main advantage of the latter is easier discoverability and the use of InstanceOfAssertFactory which is the preferred way to create type-specific assertions in AssertJ API.

Returns:

the created assertion object.
org.assertj.core.api.Java6Assertions.assertThat
(List<? extends ELEMENT>
the actual value.
actual
,
AssertFactory<ELEMENT, ELEMENT_ASSERT>
the factory used to create the elements assert instance.
assertFactory
)

This was added to help creating type-specific assertions for the elements of an List instance.

Deprecated way:

 List<String> hobbits = List.of("frodo", "sam", "Pippin");
assertThat(hobbits, StringAssert::new).first()
                                      .startsWith("fro")
                                      .endsWith("do");
However, there is a better way with InstanceOfAssertFactory and the corresponding first(InstanceOfAssertFactory).

New way:

 assertThat(hobbits).first(STRING) // static import of InstanceOfAssertFactories.STRING
                   .startsWith("fro")
                   .endsWith("do");
The main advantage of the latter is easier discoverability and the use of InstanceOfAssertFactory which is the preferred way to create type-specific assertions in AssertJ API.

Returns:

the created assertion object.
org.assertj.core.api.Java6Assertions.assertThat
(List<? extends ELEMENT>
the actual value.
actual
,
Class<ELEMENT_ASSERT>
the class used to create the elements assert instance.
assertClass
)

This was added to help creating type-specific assertions for the elements of an List instance.

Deprecated way:

 List<String> hobbits = List.of("frodo", "sam", "Pippin");
assertThat(hobbits, StringAssert.class).first()
                                       .startsWith("fro")
                                       .endsWith("do");
However, there is a better way with InstanceOfAssertFactory and the corresponding first(InstanceOfAssertFactory).

New way:

 assertThat(hobbits).first(STRING) // static import of InstanceOfAssertFactories.STRING
                   .startsWith("fro")
                   .endsWith("do");
The main advantage of the latter is easier discoverability and the use of InstanceOfAssertFactory which is the preferred way to create type-specific assertions in AssertJ API.

Returns:

The captured exception or null if none was raised by the callable.
org.assertj.core.api.Java6Assertions.catchThrowableOfType
(ThrowableAssert.ThrowingCallable
The lambda with the code that should raise the exception.
shouldRaiseThrowable
,
Class<THROWABLE>
The type of exception that the code is expected to raise.
type
)

use catchThrowableOfType(Class, ThrowingCallable) instead.

org.assertj.core.api.Java6BDDAssertions

For Android compatible assertions use the latest assertj 2.x version which is based on Java 7 only.

Android-compatible BDD-style assertions duplicated from BDDAssertions.

Returns:

the created assertion object.
org.assertj.core.api.Java6BDDAssertions.then
(Iterable<? extends ELEMENT>
the actual value.
actual
,
AssertFactory<ELEMENT, ELEMENT_ASSERT>
the factory used to create the elements assert instance.
assertFactory
)

This was added to help creating type-specific assertions for the elements of an Iterable instance.

Deprecated way:

 Iterable<String> hobbits = Set.of("frodo", "sam", "Pippin");
then(hobbits, StringAssert::new).first()
                                .startsWith("fro")
                                .endsWith("do");
However, there is a better way with InstanceOfAssertFactory and the corresponding first(InstanceOfAssertFactory).

New way:

 then(hobbits).first(STRING) // static import of InstanceOfAssertFactories.STRING
             .startsWith("fro")
             .endsWith("do");
The main advantage of the latter is easier discoverability and the use of InstanceOfAssertFactory which is the preferred way to create type-specific assertions in AssertJ API.

Returns:

the created assertion object.
org.assertj.core.api.Java6BDDAssertions.then
(ACTUAL
the actual value.
actual
,
Class<ELEMENT_ASSERT>
the class used to create the elements assert instance.
assertClass
)

This was added to help creating type-specific assertions for the elements of an Iterable instance.

Deprecated way:

 Iterable<String> hobbits = Set.of("frodo", "sam", "Pippin");
then(hobbits, StringAssert.class).first()
                                 .startsWith("fro")
                                 .endsWith("do");
However, there is a better way with InstanceOfAssertFactory and the corresponding first(InstanceOfAssertFactory).

New way:

 then(hobbits).first(STRING) // static import of InstanceOfAssertFactories.STRING
             .startsWith("fro")
             .endsWith("do");
The main advantage of the latter is easier discoverability and the use of InstanceOfAssertFactory which is the preferred way to create type-specific assertions in AssertJ API.

Returns:

the created assertion object.
org.assertj.core.api.Java6BDDAssertions.then
(List<? extends ELEMENT>
the actual value.
actual
,
AssertFactory<ELEMENT, ELEMENT_ASSERT>
the factory used to create the elements assert instance.
assertFactory
)

This was added to help creating type-specific assertions for the elements of an List instance.

Deprecated way:

 List<String> hobbits = List.of("frodo", "sam", "Pippin");
then(hobbits, StringAssert::new).first()
                                .startsWith("fro")
                                .endsWith("do");
However, there is a better way with InstanceOfAssertFactory and the corresponding first(InstanceOfAssertFactory).

New way:

 then(hobbits).first(STRING) // static import of InstanceOfAssertFactories.STRING
             .startsWith("fro")
             .endsWith("do");
The main advantage of the latter is easier discoverability and the use of InstanceOfAssertFactory which is the preferred way to create type-specific assertions in AssertJ API.

Returns:

the created assertion object.
org.assertj.core.api.Java6BDDAssertions.then
(List<? extends ELEMENT>
the actual value.
actual
,
Class<ELEMENT_ASSERT>
the class used to create the elements assert instance.
assertClass
)

This was added to help creating type-specific assertions for the elements of an List instance.

Deprecated way:

 List<String> hobbits = List.of("frodo", "sam", "Pippin");
then(hobbits, StringAssert.class).first()
                                 .startsWith("fro")
                                 .endsWith("do");
However, there is a better way with InstanceOfAssertFactory and the corresponding first(InstanceOfAssertFactory).

New way:

 then(hobbits).first(STRING) // static import of InstanceOfAssertFactories.STRING
             .startsWith("fro")
             .endsWith("do");
The main advantage of the latter is easier discoverability and the use of InstanceOfAssertFactory which is the preferred way to create type-specific assertions in AssertJ API.
org.assertj.core.api.Java6BDDSoftAssertions

For Android compatible assertions use the latest assertj 2.x version which is based on Java 7 only.

BDD-style Android-compatible soft assertions. Duplicated from BDDSoftAssertions.

org.assertj.core.api.Java6JUnitBDDSoftAssertions

For Android compatible assertions use the latest assertj 2.x version which is based on Java 7 only.

Duplicate of JUnitBDDSoftAssertions compatible with Android.

org.assertj.core.api.Java6JUnitSoftAssertions

For Android compatible assertions use the latest assertj 2.x version which is based on Java 7 only.

JUnitSoftAssertions rule compatible with Android. Duplicated from JUnitSoftAssertions.

org.assertj.core.api.Java6SoftAssertions

For Android compatible assertions use the latest assertj 2.x version which is based on Java 7 only.

Soft assertions compatible with Android. Duplicated from SoftAssertions.

Returns:

this assertion object.
org.assertj.core.api.ObjectEnumerableAssert.containsOnlyElementsOf
(Iterable<? extends ELEMENT>
the given Iterable we will get elements from.
iterable
)

Returns:

the created assertion object.
org.assertj.core.api.WithAssertions.assertThat
(Iterable<? extends ELEMENT>
the actual value.
actual
,
AssertFactory<ELEMENT, ELEMENT_ASSERT>
the factory used to create the elements assert instance.
assertFactory
)

This was added to help creating type-specific assertions for the elements of an Iterable instance.

Deprecated way:

 Iterable<String> hobbits = Set.of("frodo", "sam", "Pippin");
assertThat(hobbits, StringAssert::new).first()
                                      .startsWith("fro")
                                      .endsWith("do");
However, there is a better way with InstanceOfAssertFactory and the corresponding first(InstanceOfAssertFactory).

New way:

 assertThat(hobbits).first(STRING) // static import of InstanceOfAssertFactories.STRING
                   .startsWith("fro")
                   .endsWith("do");
The main advantage of the latter is easier discoverability and the use of InstanceOfAssertFactory which is the preferred way to create type-specific assertions in AssertJ API.

Returns:

the created assertion object.
org.assertj.core.api.WithAssertions.assertThat
(ACTUAL
the actual value.
actual
,
Class<ELEMENT_ASSERT>
the class used to create the elements assert instance.
assertClass
)

This was added to help creating type-specific assertions for the elements of an Iterable instance.

Deprecated way:

 Iterable<String> hobbits = Set.of("frodo", "sam", "Pippin");
assertThat(hobbits, StringAssert.class).first()
                                       .startsWith("fro")
                                       .endsWith("do");
However, there is a better way with InstanceOfAssertFactory and the corresponding first(InstanceOfAssertFactory).

New way:

 assertThat(hobbits).first(STRING) // static import of InstanceOfAssertFactories.STRING
                   .startsWith("fro")
                   .endsWith("do");
The main advantage of the latter is easier discoverability and the use of InstanceOfAssertFactory which is the preferred way to create type-specific assertions in AssertJ API.

Returns:

the created assertion object.
org.assertj.core.api.WithAssertions.assertThat
(List<? extends ELEMENT>
the actual value.
actual
,
Class<ELEMENT_ASSERT>
the class used to create the elements assert instance.
assertClass
)

This was added to help creating type-specific assertions for the elements of an List instance.

Deprecated way:

 List<String> hobbits = List.of("frodo", "sam", "Pippin");
assertThat(hobbits, StringAssert.class).first()
                                       .startsWith("fro")
                                       .endsWith("do");
However, there is a better way with InstanceOfAssertFactory and the corresponding first(InstanceOfAssertFactory).

New way:

 assertThat(hobbits).first(STRING) // static import of InstanceOfAssertFactories.STRING
                   .startsWith("fro")
                   .endsWith("do");
The main advantage of the latter is easier discoverability and the use of InstanceOfAssertFactory which is the preferred way to create type-specific assertions in AssertJ API.

Returns:

the created assertion object.
org.assertj.core.api.WithAssertions.assertThat
(List<? extends ELEMENT>
the actual value.
actual
,
AssertFactory<ELEMENT, ELEMENT_ASSERT>
the factory used to create the elements assert instance.
assertFactory
)

This was added to help creating type-specific assertions for the elements of an List instance.

Deprecated way:

 List<String> hobbits = List.of("frodo", "sam", "Pippin");
assertThat(hobbits, StringAssert::new).first()
                                      .startsWith("fro")
                                      .endsWith("do");
However, there is a better way with InstanceOfAssertFactory and the corresponding first(InstanceOfAssertFactory).

New way:

 assertThat(hobbits).first(STRING) // static import of InstanceOfAssertFactories.STRING
                   .startsWith("fro")
                   .endsWith("do");
The main advantage of the latter is easier discoverability and the use of InstanceOfAssertFactory which is the preferred way to create type-specific assertions in AssertJ API.

Returns:

The captured exception or null if none was raised by the callable.
org.assertj.core.api.WithAssertions.catchThrowableOfType
(ThrowableAssert.ThrowingCallable
The lambda with the code that should raise the exception.
shouldRaiseThrowable
,
Class<THROWABLE>
The type of exception that the code is expected to raise.
type
)

use catchThrowableOfType(Class, ThrowingCallable) instead.

org.assertj.core.api.iterable.Extractor<
type of element from which the conversion happens
F
,
target element type
T
>

use Function instead

org.assertj.core.api.junit.jupiter.SoftlyExtension

This functionality (and more) has been rolled into SoftAssertionsExtension as of AssertJ 3.18.0.

Returns:

true if it exactly matches this field, false otherwise
org.assertj.core.api.recursive.comparison.FieldLocation.matches
(String
field path to check
fieldPath
)

use exactlyMatches(String) instead.

Returns:

true if it exactly matches this field, false otherwise
org.assertj.core.api.recursive.comparison.FieldLocation.matches
(FieldLocation
field to check
field
)

use exactlyMatches(String) instead.

Returns:

the created ErrorMessageFactory.
org.assertj.core.error.ShouldBeBetween.shouldBeBetween
(Comparable<? super T>
the actual value in the failed assertion.
actual
,
Comparable<? super T>
the lower boundary of range.
start
,
Comparable<? super T>
the lower boundary of range.
end
,
boolean
whether to include start value in range.
inclusiveStart
,
boolean
whether to include end value in range.
inclusiveEnd
,
ComparisonStrategy
the ComparisonStrategy used to evaluate assertion.
comparisonStrategy
)

Use shouldBeBetween(Object, Object, Object, boolean, boolean, ComparisonStrategy) instead.

org.assertj.core.error.ShouldBeEqual

Deprecated as a consequence of AssertionErrorFactory being deprecated.

Returns:

the created AssertionErrorFactory.
org.assertj.core.error.ShouldBeEqual.shouldBeEqual
(Object
the actual value in the failed assertion.
actual
,
Object
the expected value in the failed assertion.
expected
,
Representation
the Representation used to format values.
representation
)

Deprecated as a consequence of AssertionErrorFactory being deprecated. See corresponding docs for further information.

Returns:

the created AssertionErrorFactory.
org.assertj.core.error.ShouldBeEqual.shouldBeEqual
(Object
the actual value in the failed assertion.
actual
,
Object
the expected value in the failed assertion.
expected
,
ComparisonStrategy
the ComparisonStrategy used to compare actual with expected.
comparisonStrategy
,
Representation
the Representation used to format values.
representation
)

Deprecated as a consequence of AssertionErrorFactory being deprecated. See corresponding docs for further information.

Returns:

the created ErrorMessageFactory.
org.assertj.core.error.ShouldBeGreater.shouldBeGreater
(Comparable<? super T>
the actual value in the failed assertion.
actual
,
Comparable<? super T>
the value used in the failed assertion to compare the actual value to.
other
,
ComparisonStrategy
the ComparisonStrategy used to evaluate assertion.
comparisonStrategy
)

Use shouldBeGreater(Object, Object, ComparisonStrategy) instead.

Returns:

the created ErrorMessageFactory.
org.assertj.core.error.ShouldBeGreaterOrEqual.shouldBeGreaterOrEqual
(Comparable<? super T>
the actual value in the failed assertion.
actual
,
Comparable<? super T>
the value used in the failed assertion to compare the actual value to.
other
,
ComparisonStrategy
the ComparisonStrategy used to evaluate assertion.
comparisonStrategy
)

Use shouldBeGreaterOrEqual(Object, Object, ComparisonStrategy) instead.

Returns:

the created ErrorMessageFactory.
org.assertj.core.error.ShouldBeLess.shouldBeLess
(T
the actual value in the failed assertion.
actual
,
T
the value used in the failed assertion to compare the actual value to.
other
,
ComparisonStrategy
the ComparisonStrategy used to evaluate assertion.
comparisonStrategy
)

Use shouldBeLess(Object, Object, ComparisonStrategy) instead.

Returns:

the created ErrorMessageFactory.
org.assertj.core.error.ShouldBeLessOrEqual.shouldBeLessOrEqual
(Comparable<? super T>
the actual value in the failed assertion.
actual
,
Comparable<? super T>
the value used in the failed assertion to compare the actual value to.
other
,
ComparisonStrategy
the ComparisonStrategy used to evaluate assertion.
comparisonStrategy
)

Use shouldBeLessOrEqual(Object, Object, ComparisonStrategy) instead.

Returns:

the created AssertionError.
org.assertj.core.internal.Failures.failure
(AssertionInfo
contains information about the failed assertion.
info
,
AssertionErrorFactory
knows how to create AssertionErrors.
factory
)

Deprecated as a consequence of AssertionErrorFactory being deprecated. See corresponding docs for further information.

org.assertj.core.internal.FieldByFieldComparator

This comparator is deprecated because it performs a shallow field by field comparison, i.e. elements are compared field by field but the fields are compared with equals, use AbstractIterableAssert#usingRecursiveFieldByFieldElementComparator(RecursiveComparisonConfiguration) or AbstractObjectAssert#usingRecursiveComparison() instead to perform a true recursive comparison.

org.assertj.core.internal.IgnoringFieldsComparator

This comparator is deprecated because it performs a shallow field by field comparison, i.e. elements are compared field by field but the fields are compared with equals, use AbstractIterableAssert#usingRecursiveFieldByFieldElementComparator(RecursiveComparisonConfiguration) or AbstractObjectAssert#usingRecursiveComparison() instead to perform a true recursive comparison.

org.assertj.core.internal.OnFieldsComparator

This comparator is deprecated because it performs a shallow field by field comparison, i.e. elements are compared field by field but the fields are compared with equals, use AbstractIterableAssert#usingRecursiveFieldByFieldElementComparator(RecursiveComparisonConfiguration) or AbstractObjectAssert#usingRecursiveComparison() instead to perform a true recursive comparison.

org.assertj.core.util.Files.delete(File
the file or directory to delete.
file
)

use https://commons.apache.org/proper/commons-io/javadocs/api-release/org/apache/commons/io/FileUtils.html#forceDelete-java.io.File- instead

Returns:

an empty, immutable List.
org.assertj.core.util.Lists.emptyList
()

use Collections#emptyList() instead.

Returns:

the String representation of the given map.
org.assertj.core.util.Maps.format
(Map<?, ?>
the map to format.
map
)

use StandardRepresentation#toStringOf(Map) instead.

Returns:

the String representation of the given map.
org.assertj.core.util.Maps.format
(Representation
the Representation to use.
p
,
Map<?, ?>
the map to format.
map
)

use StandardRepresentation#toStringOf(Map) instead.

Returns:

true if the arguments are deeply equal to each other, false otherwise.
org.assertj.core.util.Objects.areEqual
(Object
an object.
o1
,
Object
an object to be compared with o1 for deep equality.
o2
)

Use java.util.Objects#deepEquals(Object, Object) instead.

Returns:

true if the arguments are arrays and deeply equal to each other, false otherwise.
org.assertj.core.util.Objects.areEqualArrays
(Object
an object.
o1
,
Object
an object to be compared with o1 for deep equality.
o2
)

Use either java.util.Objects#deepEquals(Object, Object) or java.util.Arrays#deepEquals(Object[], Object[]).

Returns:

the non-null reference that was validated.
org.assertj.core.util.Preconditions.checkNotNull
(T
the given object reference.
reference
)

use java.util.Objects#requireNonNull(Object) instead.

Returns:

the non-null reference that was validated.
org.assertj.core.util.Preconditions.checkNotNull
(T
the given object reference.
reference
,
String
error message in case of null reference.
message
)

use java.util.Objects#requireNonNull(Object, String) instead.