Class RecursiveComparator

java.lang.Object
org.assertj.core.api.recursive.comparison.RecursiveComparator
All Implemented Interfaces:
Comparator<Object>

public class RecursiveComparator extends Object implements Comparator<Object>
Comparator comparing objects recursively as in RecursiveComparisonAssert.

This comparator does not enforce any ordering and returns zero if the compared objects are equals, according to the recursive comparison, or a non-zero value otherwise.

Since:
3.24.0
  • Constructor Details

    • RecursiveComparator

      public RecursiveComparator()
      Returns a new RecursiveComparator that uses the default RecursiveComparisonConfiguration when comparing objects with the recursive comparison.
      Since:
      3.25.0
    • RecursiveComparator

      public RecursiveComparator(RecursiveComparisonConfiguration recursiveComparisonConfiguration)
      Returns a new RecursiveComparator that uses the given RecursiveComparisonConfiguration when comparing objects with the recursive comparison.
      Parameters:
      recursiveComparisonConfiguration - the RecursiveComparisonConfiguration instance to be used
  • Method Details

    • getDescription

      public String getDescription()
    • compare

      public int compare(Object actual, Object other)
      Returns zero if the arguments are recursively equal to each other, or non-zero otherwise (no ordering enforced).
      Specified by:
      compare in interface Comparator<Object>
      Parameters:
      actual - the object to compare to other
      other - the object to compare to actual
      Returns:
      zero if the arguments are recursively equal to each other, or non-zero otherwise.