Class Configuration
- java.lang.Object
-
- org.assertj.core.configuration.Configuration
-
public class Configuration extends Object
All configuration settings for AssertJ Core.- Since:
- 3.13.0
-
-
Field Summary
Fields Modifier and Type Field Description private List<DateFormat>
additionalDateFormats
static boolean
ALLOW_COMPARING_PRIVATE_FIELDS
static boolean
ALLOW_EXTRACTING_PRIVATE_FIELDS
static boolean
BARE_NAME_PROPERTY_EXTRACTION_ENABLED
private boolean
bareNamePropertyExtraction
private boolean
comparingPrivateFields
static Configuration
DEFAULT_CONFIGURATION
private boolean
extractingPrivateFields
static boolean
LENIENT_DATE_PARSING
private boolean
lenientDateParsing
static int
MAX_ELEMENTS_FOR_PRINTING
static int
MAX_LENGTH_FOR_SINGLE_LINE_DESCRIPTION
private int
maxElementsForPrinting
private int
maxLengthForSingleLineDescription
static boolean
REMOVE_ASSERTJ_RELATED_ELEMENTS_FROM_STACK_TRACE
private boolean
removeAssertJRelatedElementsFromStackTrace
-
Constructor Summary
Constructors Constructor Description Configuration()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAdditionalDateFormats(DateFormat... additionalDateFormats)
Add the given date formats AssertJ will use in date assertions.List<DateFormat>
additionalDateFormats()
AssertJ uses defaults date formats in date assertions, this property let's you register additional ones (default there are no additional date formats).void
apply()
Applies this configuration to AssertJ.void
applyAndDisplay()
Applies this configuration to AssertJ and prints it.boolean
bareNamePropertyExtractionEnabled()
Returns whether the extractor considers bare-named property methods likeString name()
.boolean
comparingPrivateFieldsEnabled()
Returns whether private fields comparison is enabled.String
describe()
private String
describe(DateFormat dateFormat)
private String
describeAdditionalDateFormats()
boolean
extractingPrivateFieldsEnabled()
Returns whether private fields comparison is enabled.(package private) boolean
hasCustomRepresentation()
boolean
lenientDateParsingEnabled()
Returns whether AssertJ will use lenient parsing mode for default date formats.int
maxElementsForPrinting()
Returns the maximum length for an iterable/array to be displayed on one line.int
maxLengthForSingleLineDescription()
Returns the maximum length for an iterable/array to be displayed on one line.boolean
removeAssertJRelatedElementsFromStackTraceEnabled()
Returns whether AssertJ related elements are removed from assertion errors stack trace.Representation
representation()
void
setAdditionalDateFormats(List<DateFormat> additionalDateFormats)
Returns the additional date formats AssertJ will use in date assertions.void
setBareNamePropertyExtraction(boolean bareNamePropertyExtraction)
Sets whether the extractor considers bare-named property methods likeString name()
.void
setComparingPrivateFields(boolean comparingPrivateFields)
Sets whether private fields comparison is enabled.void
setExtractingPrivateFields(boolean extractingPrivateFields)
Sets whether private fields comparison is enabled.void
setLenientDateParsing(boolean lenientDateParsing)
Returns whether AssertJ will use lenient parsing mode for default date formats.void
setMaxElementsForPrinting(int maxElementsForPrinting)
Returns the maximum length for an iterable/array to be displayed on one line.void
setMaxLengthForSingleLineDescription(int maxLengthForSingleLineDescription)
Sets the maximum length for an iterable/array to be displayed on one line.void
setRemoveAssertJRelatedElementsFromStackTrace(boolean removeAssertJRelatedElementsFromStackTrace)
Returns whether AssertJ related elements are removed from assertion errors stack trace.
-
-
-
Field Detail
-
DEFAULT_CONFIGURATION
public static final Configuration DEFAULT_CONFIGURATION
-
MAX_LENGTH_FOR_SINGLE_LINE_DESCRIPTION
public static final int MAX_LENGTH_FOR_SINGLE_LINE_DESCRIPTION
- See Also:
- Constant Field Values
-
MAX_ELEMENTS_FOR_PRINTING
public static final int MAX_ELEMENTS_FOR_PRINTING
- See Also:
- Constant Field Values
-
REMOVE_ASSERTJ_RELATED_ELEMENTS_FROM_STACK_TRACE
public static final boolean REMOVE_ASSERTJ_RELATED_ELEMENTS_FROM_STACK_TRACE
- See Also:
- Constant Field Values
-
ALLOW_COMPARING_PRIVATE_FIELDS
public static final boolean ALLOW_COMPARING_PRIVATE_FIELDS
- See Also:
- Constant Field Values
-
ALLOW_EXTRACTING_PRIVATE_FIELDS
public static final boolean ALLOW_EXTRACTING_PRIVATE_FIELDS
- See Also:
- Constant Field Values
-
BARE_NAME_PROPERTY_EXTRACTION_ENABLED
public static final boolean BARE_NAME_PROPERTY_EXTRACTION_ENABLED
- See Also:
- Constant Field Values
-
LENIENT_DATE_PARSING
public static final boolean LENIENT_DATE_PARSING
- See Also:
- Constant Field Values
-
comparingPrivateFields
private boolean comparingPrivateFields
-
extractingPrivateFields
private boolean extractingPrivateFields
-
bareNamePropertyExtraction
private boolean bareNamePropertyExtraction
-
removeAssertJRelatedElementsFromStackTrace
private boolean removeAssertJRelatedElementsFromStackTrace
-
lenientDateParsing
private boolean lenientDateParsing
-
additionalDateFormats
private List<DateFormat> additionalDateFormats
-
maxLengthForSingleLineDescription
private int maxLengthForSingleLineDescription
-
maxElementsForPrinting
private int maxElementsForPrinting
-
-
Method Detail
-
representation
public Representation representation()
- Returns:
- the default
Representation
that is used within AssertJ.
-
hasCustomRepresentation
boolean hasCustomRepresentation()
-
comparingPrivateFieldsEnabled
public boolean comparingPrivateFieldsEnabled()
Returns whether private fields comparison is enabled. Default is true.See
Assertions.setAllowComparingPrivateFields(boolean)
for a detailed description.- Returns:
- whether private fields comparison is enabled.
-
setComparingPrivateFields
public void setComparingPrivateFields(boolean comparingPrivateFields)
Sets whether private fields comparison is enabled.See
Assertions.setAllowComparingPrivateFields(boolean)
for a detailed description.Note that this change will only be effective once
apply()
orapplyAndDisplay()
is called.- Parameters:
comparingPrivateFields
- whether private fields comparison is enabled.
-
extractingPrivateFieldsEnabled
public boolean extractingPrivateFieldsEnabled()
Returns whether private fields comparison is enabled. Default is true.See
Assertions.setAllowExtractingPrivateFields(boolean)
for a detailed description.- Returns:
- whether private fields comparison is enabled.
-
setExtractingPrivateFields
public void setExtractingPrivateFields(boolean extractingPrivateFields)
Sets whether private fields comparison is enabled.See
Assertions.setAllowExtractingPrivateFields(boolean)
for a detailed description.Note that this change will only be effective once
apply()
orapplyAndDisplay()
is called.- Parameters:
extractingPrivateFields
- whether private fields comparison is enabled.
-
bareNamePropertyExtractionEnabled
public boolean bareNamePropertyExtractionEnabled()
Returns whether the extractor considers bare-named property methods likeString name()
. Default is true.See
Assertions.setExtractBareNamePropertyMethods(boolean)
for a detailed description.- Returns:
- whether the extractor considers bare-named property methods like
String name()
.
-
setBareNamePropertyExtraction
public void setBareNamePropertyExtraction(boolean bareNamePropertyExtraction)
Sets whether the extractor considers bare-named property methods likeString name()
.See
Assertions.setExtractBareNamePropertyMethods(boolean)
for a detailed description.Note that this change will only be effective once
apply()
orapplyAndDisplay()
is called.- Parameters:
bareNamePropertyExtraction
- whether the extractor considers bare-named property methods.
-
removeAssertJRelatedElementsFromStackTraceEnabled
public boolean removeAssertJRelatedElementsFromStackTraceEnabled()
Returns whether AssertJ related elements are removed from assertion errors stack trace. Default is true.See
Assertions.setRemoveAssertJRelatedElementsFromStackTrace(boolean)
for a detailed description.- Returns:
- whether AssertJ related elements are removed from assertion errors stack trace.
-
setRemoveAssertJRelatedElementsFromStackTrace
public void setRemoveAssertJRelatedElementsFromStackTrace(boolean removeAssertJRelatedElementsFromStackTrace)
Returns whether AssertJ related elements are removed from assertion errors stack trace.See
Assertions.setRemoveAssertJRelatedElementsFromStackTrace(boolean)
for a detailed description.Note that this change will only be effective once
apply()
orapplyAndDisplay()
is called.- Parameters:
removeAssertJRelatedElementsFromStackTrace
- whether AssertJ related elements are removed from assertion errors stack trace.
-
lenientDateParsingEnabled
public boolean lenientDateParsingEnabled()
Returns whether AssertJ will use lenient parsing mode for default date formats. Default is false.See
Assertions.setLenientDateParsing(boolean)
for a detailed description.- Returns:
- whether AssertJ will use lenient parsing mode for default date formats.
-
setLenientDateParsing
public void setLenientDateParsing(boolean lenientDateParsing)
Returns whether AssertJ will use lenient parsing mode for default date formats.See
Assertions.setLenientDateParsing(boolean)
for a detailed description.Note that this change will only be effective once
apply()
orapplyAndDisplay()
is called.- Parameters:
lenientDateParsing
- whether AssertJ will use lenient parsing mode for default date formats.
-
additionalDateFormats
public List<DateFormat> additionalDateFormats()
AssertJ uses defaults date formats in date assertions, this property let's you register additional ones (default there are no additional date formats).See
Assertions.registerCustomDateFormat(java.text.DateFormat)
for a detailed description.- Returns:
- the date formats AssertJ will use in date assertions in addition the default ones.
-
setAdditionalDateFormats
public void setAdditionalDateFormats(List<DateFormat> additionalDateFormats)
Returns the additional date formats AssertJ will use in date assertions.See
Assertions.registerCustomDateFormat(java.text.DateFormat)
for a detailed description.Note that this change will only be effective once
apply()
orapplyAndDisplay()
is called.- Parameters:
additionalDateFormats
- the date formats AssertJ will use in date assertions in addition the default ones.
-
addAdditionalDateFormats
public void addAdditionalDateFormats(DateFormat... additionalDateFormats)
Add the given date formats AssertJ will use in date assertions.See
Assertions.registerCustomDateFormat(java.text.DateFormat)
for a detailed description.Note that this change will only be effective once
apply()
orapplyAndDisplay()
is called.- Parameters:
additionalDateFormats
- the date formats AssertJ will use in date assertions in addition the default ones.
-
maxLengthForSingleLineDescription
public int maxLengthForSingleLineDescription()
Returns the maximum length for an iterable/array to be displayed on one line. Default is 80.See
Assertions.setMaxLengthForSingleLineDescription(int)
for a detailed description.- Returns:
- the maximum length for an iterable/array to be displayed on one line.
-
setMaxLengthForSingleLineDescription
public void setMaxLengthForSingleLineDescription(int maxLengthForSingleLineDescription)
Sets the maximum length for an iterable/array to be displayed on one line.See
Assertions.setMaxLengthForSingleLineDescription(int)
for a detailed description.Note that this change will only be effective once
apply()
orapplyAndDisplay()
is called.- Parameters:
maxLengthForSingleLineDescription
- the maximum length for an iterable/array to be displayed on one line.
-
maxElementsForPrinting
public int maxElementsForPrinting()
Returns the maximum length for an iterable/array to be displayed on one line. Default is 1000.See
Assertions.setMaxLengthForSingleLineDescription(int)
for a detailed description.- Returns:
- the maximum length for an iterable/array to be displayed on one line.
-
setMaxElementsForPrinting
public void setMaxElementsForPrinting(int maxElementsForPrinting)
Returns the maximum length for an iterable/array to be displayed on one line.See
Assertions.setMaxLengthForSingleLineDescription(int)
for a detailed description.Note that this change will only be effective once
apply()
orapplyAndDisplay()
is called.- Parameters:
maxElementsForPrinting
- the maximum length for an iterable/array to be displayed on one line.
-
apply
public void apply()
Applies this configuration to AssertJ.
-
applyAndDisplay
public void applyAndDisplay()
Applies this configuration to AssertJ and prints it.
-
describe
public String describe()
-
describeAdditionalDateFormats
private String describeAdditionalDateFormats()
-
describe
private String describe(DateFormat dateFormat)
-
-