public class Configuration extends Object
| Modifier and Type | Field and Description |
|---|---|
static boolean |
ALLOW_COMPARING_PRIVATE_FIELDS |
static boolean |
ALLOW_EXTRACTING_PRIVATE_FIELDS |
static boolean |
BARE_NAME_PROPERTY_EXTRACTION_ENABLED |
static Configuration |
DEFAULT_CONFIGURATION |
static boolean |
LENIENT_DATE_PARSING |
static int |
MAX_ELEMENTS_FOR_PRINTING |
static int |
MAX_LENGTH_FOR_SINGLE_LINE_DESCRIPTION |
static int |
MAX_STACKTRACE_ELEMENTS_DISPLAYED |
static PreferredAssumptionException |
PREFERRED_ASSUMPTION_EXCEPTION |
static boolean |
PRINT_ASSERTIONS_DESCRIPTION_ENABLED |
static boolean |
REMOVE_ASSERTJ_RELATED_ELEMENTS_FROM_STACK_TRACE |
| Constructor and Description |
|---|
Configuration() |
| Modifier and Type | Method and 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 like
String name(). |
boolean |
comparingPrivateFieldsEnabled()
Returns whether private fields comparison is enabled.
|
String |
describe() |
Consumer<Description> |
descriptionConsumer() |
boolean |
extractingPrivateFieldsEnabled()
Returns whether private fields comparison is enabled.
|
boolean |
lenientDateParsingEnabled()
Returns whether AssertJ will use lenient parsing mode for default date formats.
|
int |
maxElementsForPrinting()
Returns how many elements at most from one iterable/array/map will be displayed in error messages.
|
int |
maxLengthForSingleLineDescription()
Returns the maximum length for an iterable/array to be displayed on one line.
|
int |
maxStackTraceElementsDisplayed()
Returns the maximum number of lines for a stacktrace to be displayed on one throw.
|
PreferredAssumptionException |
preferredAssumptionException()
Returns which exception is thrown if an assumption is not met.
|
boolean |
printAssertionsDescription() |
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 like
String name(). |
void |
setComparingPrivateFields(boolean comparingPrivateFields)
Sets whether private fields comparison is enabled.
|
void |
setDescriptionConsumer(Consumer<Description> descriptionConsumer) |
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)
Sets the threshold for how many elements at most from one iterable/array/map will be displaye in error messages.
|
void |
setMaxLengthForSingleLineDescription(int maxLengthForSingleLineDescription)
Sets the maximum length for an iterable/array to be displayed on one line.
|
void |
setMaxStackTraceElementsDisplayed(int maxStackTraceElementsDisplayed)
Returns the maximum number of lines for a stacktrace to be displayed on one throw.
|
void |
setPreferredAssumptionException(PreferredAssumptionException preferredAssumptionException)
Sets which exception is thrown if an assumption is not met.
|
void |
setPrintAssertionsDescriptionEnabled(boolean printAssertionsDescription) |
void |
setRemoveAssertJRelatedElementsFromStackTrace(boolean removeAssertJRelatedElementsFromStackTrace)
Returns whether AssertJ related elements are removed from assertion errors stack trace.
|
public static final int MAX_LENGTH_FOR_SINGLE_LINE_DESCRIPTION
public static final int MAX_ELEMENTS_FOR_PRINTING
public static final boolean REMOVE_ASSERTJ_RELATED_ELEMENTS_FROM_STACK_TRACE
public static final boolean ALLOW_COMPARING_PRIVATE_FIELDS
public static final boolean ALLOW_EXTRACTING_PRIVATE_FIELDS
public static final boolean BARE_NAME_PROPERTY_EXTRACTION_ENABLED
public static final boolean LENIENT_DATE_PARSING
public static final boolean PRINT_ASSERTIONS_DESCRIPTION_ENABLED
public static final int MAX_STACKTRACE_ELEMENTS_DISPLAYED
public static final PreferredAssumptionException PREFERRED_ASSUMPTION_EXCEPTION
public static final Configuration DEFAULT_CONFIGURATION
public Representation representation()
Representation that is used within AssertJ.public boolean comparingPrivateFieldsEnabled()
See Assertions.setAllowComparingPrivateFields(boolean) for a detailed description.
public void setComparingPrivateFields(boolean comparingPrivateFields)
See Assertions.setAllowComparingPrivateFields(boolean) for a detailed description.
Note that this change will only be effective once apply() or applyAndDisplay() is called.
comparingPrivateFields - whether private fields comparison is enabled.public boolean extractingPrivateFieldsEnabled()
See Assertions.setAllowExtractingPrivateFields(boolean) for a detailed description.
public void setExtractingPrivateFields(boolean extractingPrivateFields)
See Assertions.setAllowExtractingPrivateFields(boolean) for a detailed description.
Note that this change will only be effective once apply() or applyAndDisplay() is called.
extractingPrivateFields - whether private fields comparison is enabled.public boolean bareNamePropertyExtractionEnabled()
String name().
Default is true.
See Assertions.setExtractBareNamePropertyMethods(boolean) for a detailed description.
String name().public void setBareNamePropertyExtraction(boolean bareNamePropertyExtraction)
String name().
See Assertions.setExtractBareNamePropertyMethods(boolean) for a detailed description.
Note that this change will only be effective once apply() or applyAndDisplay() is called.
bareNamePropertyExtraction - whether the extractor considers bare-named property methods.public boolean removeAssertJRelatedElementsFromStackTraceEnabled()
See Assertions.setRemoveAssertJRelatedElementsFromStackTrace(boolean) for a detailed description.
public void setRemoveAssertJRelatedElementsFromStackTrace(boolean removeAssertJRelatedElementsFromStackTrace)
See Assertions.setRemoveAssertJRelatedElementsFromStackTrace(boolean) for a detailed description.
Note that this change will only be effective once apply() or applyAndDisplay() is called.
removeAssertJRelatedElementsFromStackTrace - whether AssertJ related elements are removed from assertion errors stack trace.public boolean lenientDateParsingEnabled()
See Assertions.setLenientDateParsing(boolean) for a detailed description.
public void setLenientDateParsing(boolean lenientDateParsing)
See Assertions.setLenientDateParsing(boolean) for a detailed description.
Note that this change will only be effective once apply() or applyAndDisplay() is called.
lenientDateParsing - whether AssertJ will use lenient parsing mode for default date formats.public List<DateFormat> additionalDateFormats()
See Assertions.registerCustomDateFormat(java.text.DateFormat) for a detailed description.
public void setAdditionalDateFormats(List<DateFormat> additionalDateFormats)
See Assertions.registerCustomDateFormat(java.text.DateFormat) for a detailed description.
Note that this change will only be effective once apply() or applyAndDisplay() is called.
additionalDateFormats - the date formats AssertJ will use in date assertions in addition the default ones.public void addAdditionalDateFormats(DateFormat... additionalDateFormats)
See Assertions.registerCustomDateFormat(java.text.DateFormat) for a detailed description.
Note that this change will only be effective once apply() or applyAndDisplay() is called.
additionalDateFormats - the date formats AssertJ will use in date assertions in addition the default ones.public int maxLengthForSingleLineDescription()
See Assertions.setMaxLengthForSingleLineDescription(int) for a detailed description.
public void setMaxLengthForSingleLineDescription(int maxLengthForSingleLineDescription)
See Assertions.setMaxLengthForSingleLineDescription(int) for a detailed description.
Note that this change will only be effective once apply() or applyAndDisplay() is called.
maxLengthForSingleLineDescription - the maximum length for an iterable/array to be displayed on one line.public int maxElementsForPrinting()
Default is 1000.
See Assertions.setMaxElementsForPrinting(int) for a detailed description.
public void setMaxElementsForPrinting(int maxElementsForPrinting)
See Assertions.setMaxElementsForPrinting(int) for a detailed description.
Note that this change will only be effective once apply() or applyAndDisplay() is called.
maxElementsForPrinting - the maximum length for an iterable/array to be displayed on one line.public boolean printAssertionsDescription()
public void setPrintAssertionsDescriptionEnabled(boolean printAssertionsDescription)
public Consumer<Description> descriptionConsumer()
public void setDescriptionConsumer(Consumer<Description> descriptionConsumer)
public int maxStackTraceElementsDisplayed()
See (int) for a detailed description.
public void setMaxStackTraceElementsDisplayed(int maxStackTraceElementsDisplayed)
See (int) for a detailed description.
Note that this change will only be effective once apply() or applyAndDisplay() is called.
maxStackTraceElementsDisplayed - the maximum number of lines for a stacktrace to be displayed on one throw.public PreferredAssumptionException preferredAssumptionException()
See Assumptions.setPreferredAssumptionException(PreferredAssumptionException) for a detailed description.
public void setPreferredAssumptionException(PreferredAssumptionException preferredAssumptionException)
See Assumptions.setPreferredAssumptionException(PreferredAssumptionException) for a detailed description.
Note that this change will only be effective once apply() or applyAndDisplay() is called.
preferredAssumptionException - the preferred exception to use with Assumptions.public void apply()
public void applyAndDisplay()
public String describe()
Copyright © 2025. All rights reserved.