Package h07.util
Class Config
- java.lang.Object
-
- h07.util.Config
-
public class Config extends Object
Contains constants that are used as settings for tests and utility classes. They will not be overwritten when an update is downloaded (assuming this file is inEXCLUDED_FILES
), but will be updated is such a way that everything between the lines containing ">>>##" and "##<<<" will be kept. This includes any changes or appended code.
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
AUTO_UPDATE
Setting forUpdater
.static boolean
CHECK_FOR_UPDATES
Setting forUpdater
.static int
DEFAULT_NUMBER_OF_TEST_RUNS
The number of times to repeat random parameterized tests.static List<String>
EXCLUDED_FILES
A list of files (with path relative to project root) to be excluded from updates.static Map<String,String>
FIELD_NAME
Allows to set the name of a field manually.static Map<String,Stream<? extends Arguments>>
INJECTED_ARGUMENTS
Allows injection of custom arguments into a parameterized test.static Map<String,Integer>
NUMBER_OF_TEST_RUNS
Allows customization of the number of test runs for a parameterized test.static Long
SEED
Seed that is used for initialization ofTestClass.RANDOM
.
-
Constructor Summary
Constructors Constructor Description Config()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Set<String>
getConfigs()
Returns a set of the names of all fields in this class.
-
-
-
Field Detail
-
SEED
public static final Long SEED
Seed that is used for initialization ofTestClass.RANDOM
.
Set to a fixed value other thannull
for (hopefully) reproducible results.
-
CHECK_FOR_UPDATES
public static final boolean CHECK_FOR_UPDATES
- See Also:
- Constant Field Values
-
AUTO_UPDATE
public static final boolean AUTO_UPDATE
Setting forUpdater
.
If set totrue
, the updater will automatically download the most recent files from the repository if an update is available. Enabling this option will overwrite files with matching names / paths, including those added by the installer or previously existing files. This means that local changes will also be lost. Specific files can be excluded by adding them toEXCLUDED_FILES
.- See Also:
- Constant Field Values
-
EXCLUDED_FILES
public static final List<String> EXCLUDED_FILES
A list of files (with path relative to project root) to be excluded from updates. This does not prevent updates to this configuration file (AUTO_UPDATE
does that), it just prevents complete overwrites.
-
DEFAULT_NUMBER_OF_TEST_RUNS
public static final int DEFAULT_NUMBER_OF_TEST_RUNS
The number of times to repeat random parameterized tests. This value is overridden byNUMBER_OF_TEST_RUNS
. The default value is 5.- See Also:
- Constant Field Values
-
NUMBER_OF_TEST_RUNS
public static final Map<String,Integer> NUMBER_OF_TEST_RUNS
Allows customization of the number of test runs for a parameterized test. To override the number of runs, add an entry consisting of the type name + '#' + the method signature (again with type names) mapped to an integer value (example below). If the method is not in this map, the default value is used.
-
INJECTED_ARGUMENTS
public static final Map<String,Stream<? extends Arguments>> INJECTED_ARGUMENTS
Allows injection of custom arguments into a parameterized test. Like forNUMBER_OF_TEST_RUNS
, the key is the type name of the test class, followed by '#' and the method signature. The value is a stream of arguments. These arguments must match the number and types of the test method's parameters. Injected arguments will always be tested first. If the number of test runs n (default or adjusted) is less than the number of arguments in the stream, tests will be run with the first n arguments. The number and types of arguments must match the ones expected by the test method.
-
FIELD_NAME
public static final Map<String,String> FIELD_NAME
Allows to set the name of a field manually. For fields that don't have a fixed name, a selection by criteria can be used to find that field. In some cases this might not yield usable results e.g., because there may be multiple fields that match a predicate. In this case the name of the field in the implementation may be specified manually. The key is the type name of the test class, followed by '#' and the identifier passed toTestClass.getFieldByCriteria(String, Predicate)
(usually the name of the field in the test class). The value is the actual name of the field (case-sensitive).
-
-