Class ComparingSnakeOrCamelCaseFields
java.lang.Object
org.assertj.core.api.recursive.comparison.ComparingNormalizedFields
org.assertj.core.api.recursive.comparison.ComparingSnakeOrCamelCaseFields
- All Implemented Interfaces:
RecursiveComparisonIntrospectionStrategy
A
RecursiveComparisonIntrospectionStrategy that transforms snake case field names into camel case.
The normalization also normalize uppercase acronyms by keeping only the first acronym letter uppercase so that
profile_url and profileURL can be matched, both being normalized to profileUrl.
- Since:
- 3.24.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns a human-readable description of the strategy to be used in error messages.normalizeFieldName(String name) Transforms snake case field names into camel case (leave camel case fields as is).Methods inherited from class org.assertj.core.api.recursive.comparison.ComparingNormalizedFields
getChildNodeValue, getChildrenNodeNamesOf
-
Field Details
-
COMPARING_SNAKE_OR_CAMEL_CASE_FIELDS
-
-
Constructor Details
-
ComparingSnakeOrCamelCaseFields
public ComparingSnakeOrCamelCaseFields()
-
-
Method Details
-
normalizeFieldName
Transforms snake case field names into camel case (leave camel case fields as is).For example, this allows to compare
Personobject with camel case fields likefirstNameto aPersonDtoobject with snake case fields likefirst_name.- Specified by:
normalizeFieldNamein classComparingNormalizedFields- Parameters:
name- the field name to normalize- Returns:
- camel case version of the field name
-
getDescription
Description copied from interface:RecursiveComparisonIntrospectionStrategyReturns a human-readable description of the strategy to be used in error messages.The default implementation returns
this.getClass().getSimpleName().- Specified by:
getDescriptionin interfaceRecursiveComparisonIntrospectionStrategy- Overrides:
getDescriptionin classComparingNormalizedFields- Returns:
- a description of the strategy
-