Load default configuration after default constants values to make sure the latter are initialized
@@ -37,8 +37,6 @@ import org.assertj.core.presentation.Representation;
public class Configuration {
// default values
- public static final Configuration DEFAULT_CONFIGURATION = new Configuration();
-
public static final int MAX_LENGTH_FOR_SINGLE_LINE_DESCRIPTION = 80;
public static final int MAX_ELEMENTS_FOR_PRINTING = 1000;
public static final boolean REMOVE_ASSERTJ_RELATED_ELEMENTS_FROM_STACK_TRACE = true;
@@ -50,18 +48,36 @@ public class Configuration {
public static final int MAX_STACKTRACE_ELEMENTS_DISPLAYED = 3;
public static final PreferredAssumptionException PREFERRED_ASSUMPTION_EXCEPTION = PreferredAssumptionException.AUTO_DETECT;
- private boolean comparingPrivateFields = ALLOW_COMPARING_PRIVATE_FIELDS;
- private boolean extractingPrivateFields = ALLOW_EXTRACTING_PRIVATE_FIELDS;
- private boolean bareNamePropertyExtraction = BARE_NAME_PROPERTY_EXTRACTION_ENABLED;
- private boolean removeAssertJRelatedElementsFromStackTrace = REMOVE_ASSERTJ_RELATED_ELEMENTS_FROM_STACK_TRACE;
- private boolean lenientDateParsing = LENIENT_DATE_PARSING;
- private List<DateFormat> additionalDateFormats = emptyList();
- private int maxLengthForSingleLineDescription = MAX_LENGTH_FOR_SINGLE_LINE_DESCRIPTION;
- private int maxElementsForPrinting = MAX_ELEMENTS_FOR_PRINTING;
- private boolean printAssertionsDescription = PRINT_ASSERTIONS_DESCRIPTION_ENABLED;
- private Consumer<Description> descriptionConsumer = null;
- private int maxStackTraceElementsDisplayed = MAX_STACKTRACE_ELEMENTS_DISPLAYED;
- private PreferredAssumptionException preferredAssumptionException = PREFERRED_ASSUMPTION_EXCEPTION;
+ // load default configuration after default values are initialized otherwise PREFERRED_ASSUMPTION_EXCEPTION is null
+ public static final Configuration DEFAULT_CONFIGURATION = new Configuration();
+
+ private boolean comparingPrivateFields;
+ private boolean extractingPrivateFields;
+ private boolean bareNamePropertyExtraction;
+ private boolean removeAssertJRelatedElementsFromStackTrace;
+ private boolean lenientDateParsing;
+ private List<DateFormat> additionalDateFormats;
+ private int maxLengthForSingleLineDescription;
+ private int maxElementsForPrinting;
+ private boolean printAssertionsDescription;
+ private Consumer<Description> descriptionConsumer;
+ private int maxStackTraceElementsDisplayed;
+ private PreferredAssumptionException preferredAssumptionException;
+
+ public Configuration() {
+ comparingPrivateFields = ALLOW_COMPARING_PRIVATE_FIELDS;
+ extractingPrivateFields = ALLOW_EXTRACTING_PRIVATE_FIELDS;
+ bareNamePropertyExtraction = BARE_NAME_PROPERTY_EXTRACTION_ENABLED;
+ removeAssertJRelatedElementsFromStackTrace = REMOVE_ASSERTJ_RELATED_ELEMENTS_FROM_STACK_TRACE;
+ lenientDateParsing = LENIENT_DATE_PARSING;
+ additionalDateFormats = emptyList();
+ maxLengthForSingleLineDescription = MAX_LENGTH_FOR_SINGLE_LINE_DESCRIPTION;
+ maxElementsForPrinting = MAX_ELEMENTS_FOR_PRINTING;
+ printAssertionsDescription = PRINT_ASSERTIONS_DESCRIPTION_ENABLED;
+ descriptionConsumer = null;
+ maxStackTraceElementsDisplayed = MAX_STACKTRACE_ELEMENTS_DISPLAYED;
+ preferredAssumptionException = PREFERRED_ASSUMPTION_EXCEPTION;
+ }
/**
* @return the default {@link Representation} that is used within AssertJ.
