Package h07.util

Class 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 in EXCLUDED_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 Detail

      • SEED

        public static final Long SEED
        Seed that is used for initialization of TestClass.RANDOM.
        Set to a fixed value other than null for (hopefully) reproducible results.
      • CHECK_FOR_UPDATES

        public static final boolean CHECK_FOR_UPDATES
        Setting for Updater.
        If set to true, the updater will check for updates whenever the tests are run.
        See Also:
        Constant Field Values
      • AUTO_UPDATE

        public static final boolean AUTO_UPDATE
        Setting for Updater.
        If set to true, 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 to EXCLUDED_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 by NUMBER_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 for NUMBER_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 to TestClass.getFieldByCriteria(String, Predicate) (usually the name of the field in the test class). The value is the actual name of the field (case-sensitive).
    • Constructor Detail

      • Config

        public Config()
    • Method Detail

      • getConfigs

        public static Set<String> getConfigs()
        Returns a set of the names of all fields in this class.
        Returns:
        the set