class ConfigurableRecursiveFieldByFieldComparator implements Comparator<Object> {

  private RecursiveComparisonConfiguration configuration;
  private RecursiveComparisonDifferenceCalculator recursiveComparisonDifferenceCalculator;

  // for testing
  ConfigurableRecursiveFieldByFieldComparator(RecursiveComparisonConfiguration configuration,
                                              RecursiveComparisonDifferenceCalculator recursiveComparisonDifferenceCalculator) {
    requireNonNull(configuration, "RecursiveComparisonConfiguration must not be null");
    this.configuration = configuration;
    this.recursiveComparisonDifferenceCalculator = recursiveComparisonDifferenceCalculator;
  }

  public ConfigurableRecursiveFieldByFieldComparator(RecursiveComparisonConfiguration configuration) {
    this(configuration, new RecursiveComparisonDifferenceCalculator());
  }

  @Override
  public int compare(Object actual, Object other) {
    if (actual == null && other == null) return 0;
    if (actual == null || other == null) return NOT_EQUAL;
    return areEqual(actual, other) ? 0 : NOT_EQUAL;
  }

  protected boolean areEqual(Object actual, Object other) {
    try {
      return recursiveComparisonDifferenceCalculator.determineDifferences(actual, other, configuration).isEmpty();
    } catch (@SuppressWarnings("unused") IntrospectionError e) {
      return false;
    }
  }

  @Override
  public String toString() {<FILL_FUNCTION_BODY>}

  @Override
  public int hashCode() {
    return Objects.hash(configuration);
  }

  @Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;
    if (getClass() != obj.getClass()) return false;
    ConfigurableRecursiveFieldByFieldComparator other = (ConfigurableRecursiveFieldByFieldComparator) obj;
    return Objects.equals(configuration, other.configuration);
  }

}

    return format("recursive field/property by field/property comparator on all fields/properties using the following configuration:%n%s",
                  configuration);
  
<no_super_class>