Package org.apache.rat.test
Class AbstractOptionsProvider
java.lang.Object
org.apache.rat.test.AbstractOptionsProvider
- All Implemented Interfaces:
org.junit.jupiter.params.provider.ArgumentsProvider
- Direct Known Subclasses:
AbstractConfigurationOptionsProvider
public abstract class AbstractOptionsProvider
extends Object
implements org.junit.jupiter.params.provider.ArgumentsProvider
A list of methods that an OptionsProvider in a test case must support.
Use of this interface ensures consistent testing across the UIs. Each method
tests an option from OptionCollection that must be implemented in the UI.
Each method in this interface tests an Option in
OptionCollection.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final FileThe directory to place test data in.protected static final String[]The list of exclude args.protected static final String[]The list of include args.protected final StringThe name of the provider of the options.protected final Map<String,OptionCollectionTest.OptionTest> A map of test options to tests. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractOptionsProvider(String providerName, File baseDir) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected DocumentNamebaseName()Gets the document name based on the baseDir.protected final StringdisplayArgAndName(org.apache.commons.cli.Option option, String fname) Display the option and value under testprotected final Stringdump(org.apache.commons.cli.Option option, String fname, DocumentNameMatcher matcher, DocumentName name) protected final Stringdump(DocumentNameMatcher nameMatcher, DocumentName name) static String[]extractArgs(List<org.apache.commons.lang3.tuple.Pair<org.apache.commons.cli.Option, String[]>> args) Converts eachPair<Option, String[]>into the option string and its arguments.protected abstract ReportConfigurationgenerateConfig(List<org.apache.commons.lang3.tuple.Pair<org.apache.commons.cli.Option, String[]>> args) Create the report configuration from the argument pairs.protected final ReportConfigurationgenerateConfig(org.apache.commons.lang3.tuple.Pair<org.apache.commons.cli.Option, String[]>... args) protected final DocumentNameprotected voidStream<? extends org.junit.jupiter.params.provider.Arguments>provideArguments(org.junit.jupiter.params.support.ParameterDeclarations parameters, org.junit.jupiter.api.extension.ExtensionContext context) protected voidvalidate(Collection<String> unsupportedArgs) protected FileMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.junit.jupiter.params.provider.ArgumentsProvider
provideArguments
-
Field Details
-
testMap
A map of test options to tests. -
EXCLUDE_ARGS
The list of exclude args. -
INCLUDE_ARGS
The list of include args. -
baseDir
The directory to place test data in. -
providerName
The name of the provider of the options.
-
-
Constructor Details
-
AbstractOptionsProvider
-
-
Method Details
-
processTestFunctionAnnotations
protected void processTestFunctionAnnotations() -
addTest
-
baseName
Gets the document name based on the baseDir.- Returns:
- The document name based on the baseDir.
-
validate
-
generateConfig
@SafeVarargs protected final ReportConfiguration generateConfig(org.apache.commons.lang3.tuple.Pair<org.apache.commons.cli.Option, String[]>... args) throws IOException- Throws:
IOException
-
generateConfig
protected abstract ReportConfiguration generateConfig(List<org.apache.commons.lang3.tuple.Pair<org.apache.commons.cli.Option, String[]>> args) throws IOExceptionCreate the report configuration from the argument pairs. There must be at least one arg. It may beImmutablePair.nullPair().- Parameters:
args- Pairs comprising the argument option and the values for the option.- Returns:
- The generated ReportConfiguration.
- Throws:
IOException- on error.
-
extractArgs
public static String[] extractArgs(List<org.apache.commons.lang3.tuple.Pair<org.apache.commons.cli.Option, String[]>> args) Converts eachPair<Option, String[]>into the option string and its arguments.- Parameters:
args- the argument paris to process.- Returns:
- an array of arguments for the processing.
-
writeFile
-
mkDocName
-
displayArgAndName
Display the option and value under test -
dump
-
dump
protected final String dump(org.apache.commons.cli.Option option, String fname, DocumentNameMatcher matcher, DocumentName name) -
provideArguments
public Stream<? extends org.junit.jupiter.params.provider.Arguments> provideArguments(org.junit.jupiter.params.support.ParameterDeclarations parameters, org.junit.jupiter.api.extension.ExtensionContext context) - Specified by:
provideArgumentsin interfaceorg.junit.jupiter.params.provider.ArgumentsProvider
-