Top Inners Fields Constructors Methods
org.assertj.core.api.recursive.comparison

public Class RecursiveComparisonConfiguration

extends AbstractRecursiveOperationConfiguration
Class Inheritance
Static Imports
java.lang.String.format, java.util.Arrays.stream, .Objects.requireNonNull, java.util.stream.Collectors.joining, .Collectors.toList, .Collectors.toSet, org.assertj.core.configuration.ConfigurationProvider.CONFIGURATION_PROVIDER, org.assertj.core.data.MapEntry.entry, org.assertj.core.internal.RecursiveHelper.isContainer, .TypeComparators.defaultTypeComparators, org.assertj.core.util.Lists.list, .Sets.newLinkedHashSet

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private Set<FieldLocation>
private Set<Class<?>>
private boolean
private static final boolean
public static final DefaultRecursiveComparisonIntrospectionStrategy
private FieldComparators
private final Set<FieldLocation>
private FieldMessages
private boolean
private boolean
private boolean
private boolean
private boolean
private Set<String>
private final List<Pattern>
private List<String>
private final List<Pattern>
private final List<Class<?>>
public static final String
private RecursiveComparisonIntrospectionStrategy
private boolean
private TypeComparators
private TypeMessages
Inherited from org.assertj.core.api.recursive.AbstractRecursiveOperationConfiguration:
DEFAULT_DELIMITER

Constructor Summary

AccessConstructor and Description
private
public

Method Summary

Modifier and TypeMethod and Description
public void
allowComparingEnumAgainstString(boolean
whether to allow the recursive comparison to compare enum field against string field.
compareEnumAgainstString
)

Allows the recursive comparison to compare an enum field against a string field.

public static RecursiveComparisonConfiguration.Builder

Returns:

created builder
builder
()

Creates builder to build RecursiveComparisonConfiguration.

private Optional<Map.Entry<FieldLocation, String>>
checkComparedFieldExists(Object actual, FieldLocation comparedFieldLocation)

pack-priv void
public Stream<Map.Entry<String, Comparator<?>>>
pack-priv Stream<Map.Entry<Class<?>, Comparator<?>>>
public void
compareOnlyFields(String...
the fields of the object under test to compare in the comparison.
fieldNamesToCompare
)

Adds the given fields and their subfields to the set of fields from the object under test to compare (no other fields will be compared).

public void
compareOnlyFieldsOfTypes(Class<?>...
the types to compare in the recursive comparison.
typesToCompare
)

Adds the given fields of types and their subfields to the set of fields from the object under test to compare (fields of other types will not be compared).

private void
private void
private void
private void
private String
private void
private String
private void
private void
private void
protected void
protected void
private void
private void
private void
private String
private void
private String
private String
private void
private void
private void
private void
private void
private void
private void
private void
private void
private void
private DualValue
dualValueForField(DualValue parentDualValue, String fieldName)

public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
pack-priv boolean
private String
private String
private String
private static String
formatUnknownComparedField(FieldLocation fieldLocation, String unknownNodeNameElement)

pack-priv Set<String>
pack-priv Set<String>
public Comparator<?>
public Comparator<?>
public Set<FieldLocation>

Returns:

the set of fields from the object under test to compare.
getComparedFields
()

Returns the set of fields to compare from the object under test (no other fields will be compared).

public Set<Class<?>>

Returns:

the set of types from the object under test to compare.
getComparedTypes
()

Returns the set of type to compare from the object under test (fields of other types will not be compared).

public FieldComparators
pack-priv boolean
pack-priv boolean
pack-priv boolean
pack-priv boolean
pack-priv boolean
public Set<String>

Returns:

the list fields from the object under test to ignore collection order in the recursive comparison.
getIgnoredCollectionOrderInFields
()

Returns the list fields from the object under test to ignore collection order in the recursive comparison.

public List<Pattern>

Returns:

the list of regexes used to find the object under test fields to ignore collection order in the recursive comparison.
getIgnoredCollectionOrderInFieldsMatchingRegexes
()

Returns the list of regexes used to find the object under test fields to ignore collection order in the recursive comparison.

public List<String>
public List<Pattern>
public List<Class<?>>
pack-priv RecursiveComparisonIntrospectionStrategy
public String
public String
getMessageForType(Class<?> fieldType)

public TypeComparators
pack-priv Object
getValue(String name, Object instance)

public boolean
public boolean
pack-priv boolean
pack-priv boolean
public boolean
public boolean
public boolean
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.
pack-priv boolean
public void
ignoreAllOverriddenEquals()

Force a recursive comparison on all fields (except java types).

public void
ignoreCollectionOrder(boolean
whether to ignore collection order in the comparison.
ignoreCollectionOrder
)

Sets whether to ignore collection order in the comparison.

public void
ignoreCollectionOrderInFields(String...
the fields of the object under test to ignore collection order in the comparison.
fieldsToIgnoreCollectionOrder
)

Adds the given fields to the list fields from the object under test to ignore collection order in the recursive comparison.

public void
ignoreCollectionOrderInFieldsMatchingRegexes(String...
regexes used to find the object under test fields to ignore collection order in the comparison.
regexes
)

Adds the given regexes to the list of regexes used to find the object under test fields to ignore collection order in the recursive comparison.

public void
ignoreOverriddenEqualsForFields(String...
the fields to force a recursive comparison on.
fields
)

Adds the given fields to the list of fields to force a recursive comparison on.

public void
ignoreOverriddenEqualsForFieldsMatchingRegexes(String...
regexes used to specify the fields we want to force a recursive comparison on.
regexes
)

Adds the given regexes to the list of regexes used find the fields to force a recursive comparison on.

public void
ignoreOverriddenEqualsForTypes(Class<?>...
the types to the list of types to force a recursive comparison on.
types
)

Adds the given types to the list of types to force a recursive comparison on.

public boolean
private boolean
private boolean
public boolean
pack-priv boolean
private boolean
private boolean
private boolean
private boolean
private boolean
private boolean
private boolean
private boolean
private boolean
private static Predicate<FieldLocation>
pack-priv boolean
public String
public void
registerComparatorForFields(Comparator<?>
the Comparator to use to compare the given field
comparator
,
String...
the locations from the root object of the fields the comparator should be used for
fieldLocations
)

Registers the given Comparator to compare the fields at the given locations.

public <
the class type to register a comparator for
T
>
void
registerComparatorForType(Comparator<? super T>
the Comparator to use to compare the given type
comparator
,
Class<T>
the type to be compared with the given comparator.
type
)

Registers the given Comparator to compare the fields with the given type.

public void
registerEqualsForFields(BiPredicate<?, ?>
the equals implementation to compare the given fields.
equals
,
String...
the locations from the root object of the fields the comparator should be used for
fieldLocations
)

Registers the given BiPredicate to compare the fields at the given locations.

public void
registerEqualsForFieldsMatchingRegexes(BiPredicate<?, ?>
the BiPredicate to use to compare the fields matching the given regexes
equals
,
String...
the regexes from the root object of the fields location the BiPredicate should be used for
regexes
)

Allows to register a BiPredicate to compare fields whose location matches the given regexes.

public <
the class type to register a comparator for
T
>
void
registerEqualsForType(BiPredicate<? super T, ? super T>
the equals implementation to compare the given type
equals
,
Class<T>
the type to be compared with the given equals implementation .
type
)

Registers the given BiPredicate to compare the fields with the given type.

public void
registerErrorMessageForFields(String
the error message that will be thrown when comparison error occurred
message
,
String...
the field locations the error message should be used for
fieldLocations
)

Registers the giving message which would be shown when differences in the given fields while comparison occurred.

public void
registerErrorMessageForType(String
the error message that will be thrown when comparison error occurred
message
,
Class<?>
the type the error message should be used for
clazz
)

Registers the giving message which would be shown when differences for the giving type while comparison occurred.

private void
public void
public void
setIgnoreAllActualEmptyOptionalFields(boolean
whether to ignore actual empty optional fields in the recursive comparison
ignoringAllActualEmptyOptionalFields
)

Sets whether actual empty optional fields are ignored in the recursive comparison.

public void
setIgnoreAllActualNullFields(boolean
whether to ignore actual null fields in the recursive comparison
ignoreAllActualNullFields
)

Sets whether actual null fields are ignored in the recursive comparison.

public void
setIgnoreAllExpectedNullFields(boolean
whether to ignore expected null fields in the recursive comparison
ignoreAllExpectedNullFields
)

Sets whether expected null fields are ignored in the recursive comparison.

public void
setIntrospectionStrategy(RecursiveComparisonIntrospectionStrategy introspectionStrategy)

Defines how objects are introspected in the recursive comparison.

private boolean
pack-priv boolean
pack-priv boolean
private boolean
private boolean
pack-priv boolean
pack-priv boolean
pack-priv boolean
pack-priv boolean
public void
strictTypeChecking(boolean
whether the recursive comparison will check that actual's type is compatible with expected's type.
strictTypeChecking
)

Sets whether the recursive comparison will check that actual's type is compatible with expected's type (the same applies for each field).

private static Comparator<T>
toComparator(BiPredicate<T, U> equals)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public void
useOverriddenEquals()

Force a recursive comparison on all fields (except java types).

Inherited from org.assertj.core.api.recursive.AbstractRecursiveOperationConfiguration:
asWrapperIfPrimitiveTypedescribeIgnoredFieldsdescribeIgnoredFieldsRegexesdescribeIgnoredTypesdescribeRegexesgetIgnoredFieldsgetIgnoredFieldsRegexesgetIgnoredTypesgetIgnoredTypesRegexesignoreFieldsignoreFieldsMatchingRegexesignoreFieldsOfTypesignoreFieldsOfTypesMatchingRegexesjoinmatchesAnIgnoredFieldmatchesAnIgnoredFieldRegex