Package org.apache.rat.testhelpers.data
Class TestData
java.lang.Object
org.apache.rat.testhelpers.data.TestData
- All Implemented Interfaces:
Comparable<TestData>
The definition of a test.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintbooleanDetermines if the test is expecting an exception.getArgs()Get the arguments for the command line.Gets the test name as a class name.String[]Gets the command line as the string objects that are normally parsed by the command line parser.String[]getCommandLine(String workingDir) Gets the command line as the string objects that are normally parsed by the command line parser.Gets the expected exception ornullif no exception is expected.getName()Get the sub name for this test.org.apache.commons.cli.OptionThe option for the test.Gets the test name.Gets the validator for the test.voidsetupFiles(Path path) Sets up the files for the test.toString()
-
Constructor Details
-
TestData
public TestData(String name, List<org.apache.commons.lang3.tuple.ImmutablePair<org.apache.commons.cli.Option, String[]>> commandLine, Consumer<Path> setupFiles, Consumer<ValidatorData> validator) Constructs the Test data- Parameters:
name- the sub name of the test. Must not benullbut may be an empty string. Should be specified in Camel case for multiple words.commandLine- the command line for the test. May not benullbut may consist of a singleImmutablePair.nullPair().setupFiles- the method to set up the files for the test. Must not benull.validator- the validator for the results of the test. Must not benull.
-
-
Method Details
-
toString
-
getOption
public org.apache.commons.cli.Option getOption()The option for the test. This is the first option specified in the command line. If the command line is empty this returnsnull.- Returns:
- the first option in the command line or
nullif there is no option.
-
getName
Get the sub name for this test.- Returns:
- the sub name for this test.
-
getExpectedException
Gets the expected exception ornullif no exception is expected.- Returns:
- the expected exception or
nullif no exception is expected.
-
expectingException
public boolean expectingException()Determines if the test is expecting an exception.- Returns:
trueif the test is expecting to throw an exception.
-
getCommandLine
Gets the command line as the string objects that are normally parsed by the command line parser.- Returns:
- the command line strings.
-
getCommandLine
Gets the command line as the string objects that are normally parsed by the command line parser. The result will include"--"to terminate a trailing multi argument option.- Parameters:
workingDir- the directory to add to the command line. May benull.- Returns:
- the command line strings.
-
getArgs
public List<? extends org.apache.commons.lang3.tuple.Pair<org.apache.commons.cli.Option,String[]>> getArgs()Get the arguments for the command line.- Returns:
- the arguments for the command line as Option, String[] pairs.
-
getValidator
Gets the validator for the test.- Returns:
- the validator for the test.
-
setupFiles
Sets up the files for the test.- Parameters:
path- the path to use as the base directory. Subdirectories and files may be added to this path.
-
getTestName
Gets the test name. This is the option concatenated with the name.- Returns:
- the unique test name
-
getClassName
Gets the test name as a class name. This is based on the option concatenated with the name.- Returns:
- the unique Java class name
-
compareTo
- Specified by:
compareToin interfaceComparable<TestData>
-