Class JUnitOptions

All Implemented Interfaces:
Serializable, Cloneable, Iterable<String>, Collection<String>, List<String>, RandomAccess

public class JUnitOptions extends ArrayList<String>
Options for JUnit 5.
Since:
1.5.20
See Also:
  • Constructor Details

    • JUnitOptions

      public JUnitOptions()
  • Method Details

    • addAll

      public boolean addAll(Collection<? extends String> c)
      Specified by:
      addAll in interface Collection<String>
      Specified by:
      addAll in interface List<String>
      Overrides:
      addAll in class ArrayList<String>
    • addAll

      public boolean addAll(int index, Collection<? extends String> c)
      Specified by:
      addAll in interface List<String>
      Overrides:
      addAll in class ArrayList<String>
    • set

      public String set(int index, String element)
      Specified by:
      set in interface List<String>
      Overrides:
      set in class ArrayList<String>
    • add

      public boolean add(String s)
      Specified by:
      add in interface Collection<String>
      Specified by:
      add in interface List<String>
      Overrides:
      add in class ArrayList<String>
    • add

      public void add(int index, String element)
      Specified by:
      add in interface List<String>
      Overrides:
      add in class ArrayList<String>
    • defaultOptions

      public JUnitOptions defaultOptions()
      Configures the default options that bld uses when no options have been explicitly set.
      Returns:
      this list of options
      Since:
      1.5.20
    • scanClassPath

      public JUnitOptions scanClassPath()
      Scan all directories on the classpath.

      Only directories on the system classpath as well as additional classpath entries supplied via -cp (directories and JAR files) are scanned.

      Removes all the select options since they are mutually exclusive.

      Returns:
      this list of options
      Since:
      1.5.20
    • scanClassPath

      public JUnitOptions scanClassPath(String path)
      Scan an explicit classpath root.

      Explicit classpath roots that are not on the classpath will be silently ignored.

      Removes all the select options since they are mutually exclusive.

      This option can be repeated.

      Returns:
      this list of options
      Since:
      1.5.20
    • scanModules

      public JUnitOptions scanModules()
      EXPERIMENTAL: Scan all resolved modules for test discovery

      Removes all the scanClasspath options since they are mutually exclusive.

      Removes all the scanClasspath options since they are mutually exclusive.

      Returns:
      this list of options
      Since:
      1.5.20
    • selectUri

      public JUnitOptions selectUri(String uri)
      Select a URI for test discovery.

      Removes all the scanClasspath options since they are mutually exclusive.

      This option can be repeated.

      Returns:
      this list of options
      Since:
      1.5.20
    • selectFile

      public JUnitOptions selectFile(File file)
      Select a file for test discovery.

      Removes all the scanClasspath options since they are mutually exclusive.

      This option can be repeated.

      Returns:
      this list of options
      Since:
      1.5.20
    • selectDirectory

      public JUnitOptions selectDirectory(File file)
      Select a directory for test discovery.

      Removes all the scanClasspath options since they are mutually exclusive.

      This option can be repeated.

      Returns:
      this list of options
      Since:
      1.5.20
    • selectModule

      public JUnitOptions selectModule(String name)
      EXPERIMENTAL: Select single module for test discovery.

      Removes all the scanClasspath options since they are mutually exclusive.

      This option can be repeated.

      Returns:
      this list of options
      Since:
      1.5.20
    • selectPackage

      public JUnitOptions selectPackage(String name)
      Select a package for test discovery.

      Removes all the scanClasspath options since they are mutually exclusive.

      This option can be repeated.

      Returns:
      this list of options
      Since:
      1.5.20
    • selectClass

      public JUnitOptions selectClass(String name)
      Select a class for test discovery.

      Removes all the scanClasspath options since they are mutually exclusive.

      This option can be repeated.

      Returns:
      this list of options
      Since:
      1.5.20
    • selectMethod

      public JUnitOptions selectMethod(String name)
      Select a method for test discovery.

      Removes all the scanClasspath options since they are mutually exclusive.

      This option can be repeated.

      Returns:
      this list of options
      Since:
      1.5.20
    • selectResource

      public JUnitOptions selectResource(String resource)
      Select a classpath resource for test discovery.

      Removes all the scanClasspath options since they are mutually exclusive.

      This option can be repeated.

      Returns:
      this list of options
      Since:
      1.5.20
    • selectIteration

      public JUnitOptions selectIteration(String iteration)
      Select iterations for test discovery of format TYPE:VALUE[INDEX(..INDEX)?(,INDEX(..INDEX)?)*] (e.g. method:com.acme.Foo#m()[1..2]).

      Removes all the scanClasspath options since they are mutually exclusive.

      This option can be repeated.

      Returns:
      this list of options
      Since:
      1.5.20
    • includeClassname

      public JUnitOptions includeClassname(String regexPattern)
      Provide a regular expression to include only classes whose fully qualified names match. To avoid loading classes unnecessarily, the default pattern only includes class names that begin with "Test" or end with "Test" or "Tests". When this option is repeated, all patterns will be combined using OR semantics. Default: ^(Test.*|.+[.$]Test.*|.*Tests?)$

      This option can be repeated.

      Returns:
      this list of options
      Since:
      1.5.20
    • excludeClassname

      public JUnitOptions excludeClassname(String regexPattern)
      Provide a regular expression to exclude those classes whose fully qualified names match. When this option is repeated, all patterns will be combined using OR semantics.

      This option can be repeated.

      Returns:
      this list of options
      Since:
      1.5.20
    • includePackage

      public JUnitOptions includePackage(String name)
      Provide a package to be included in the test run. This option can be repeated.

      This option can be repeated.

      Returns:
      this list of options
      Since:
      1.5.20
    • excludePackage

      public JUnitOptions excludePackage(String name)
      Provide a package to be excluded from the test run. This option can be repeated.

      This option can be repeated.

      Returns:
      this list of options
      Since:
      1.5.20
    • includeTag

      public JUnitOptions includeTag(String tag)
      Provide a tag or tag expression to include only tests whose tags match. When this option is repeated, all patterns will be combined using OR semantics.
      Returns:
      this list of options
      Since:
      1.5.20
    • excludeTag

      public JUnitOptions excludeTag(String tag)
      Provide a tag or tag expression to exclude those tests whose tags match. When this option is repeated, all patterns will be combined using OR semantics.
      Returns:
      this list of options
      Since:
      1.5.20
    • includeEngine

      public JUnitOptions includeEngine(String id)
      Provide the ID of an engine to be included in the test run.

      This option can be repeated.

      Returns:
      this list of options
      Since:
      1.5.20
    • excludeEngine

      public JUnitOptions excludeEngine(String id)
      Provide the ID of an engine to be excluded in the test run.

      This option can be repeated.

      Returns:
      this list of options
      Since:
      1.5.20
    • config

      public JUnitOptions config(String key, String value)
      Set a configuration parameter for test discovery and execution.

      This option can be repeated.

      Returns:
      this list of options
      Since:
      1.5.20
    • failIfNoTests

      public JUnitOptions failIfNoTests()
      Fail and return exit status code 2 if no tests are found.
      Returns:
      this list of options
      Since:
      1.5.20
    • reportsDir

      public JUnitOptions reportsDir(File dir)
      Enable report output into a specified local directory (will be created if it does not exist).
      Returns:
      this list of options
      Since:
      1.5.20
    • disableAnsiColors

      public JUnitOptions disableAnsiColors()
      Disable ANSI colors in output (not supported by all terminals).
      Returns:
      this list of options
      Since:
      1.5.20
    • colorPalette

      public JUnitOptions colorPalette(File file)
      Specify a path to a properties file to customize ANSI style of output (not supported by all terminals).
      Returns:
      this list of options
      Since:
      1.5.20
    • singleColor

      public JUnitOptions singleColor()
      Style test output using only text attributes, no color (not supported by all terminals).
      Returns:
      this list of options
      Since:
      1.5.20
    • disableBanner

      public JUnitOptions disableBanner()
      Disable print out of the welcome message.
      Returns:
      this list of options
      Since:
      1.5.20
    • details

      public JUnitOptions details(JUnitOptions.Details details)
      Select an output details mode for when tests are executed.

      If 'none' is selected, then only the summary and test failures are shown.

      Default: JUnitOptions.Details.TREE.

      Returns:
      this list of options
      Since:
      1.5.20
    • detailsTheme

      public JUnitOptions detailsTheme(JUnitOptions.Theme theme)
      Select an output details tree theme for when tests are executed.

      Default is detected based on default character encoding.

      Returns:
      this list of options
      Since:
      1.5.20