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 Details

    • testMap

      protected final Map<String,OptionCollectionTest.OptionTest> testMap
      A map of test options to tests.
    • EXCLUDE_ARGS

      protected static final String[] EXCLUDE_ARGS
      The list of exclude args.
    • INCLUDE_ARGS

      protected static final String[] INCLUDE_ARGS
      The list of include args.
    • baseDir

      protected final File baseDir
      The directory to place test data in.
    • providerName

      protected final String providerName
      The name of the provider of the options.
  • Constructor Details

    • AbstractOptionsProvider

      protected AbstractOptionsProvider(String providerName, File baseDir)
  • Method Details

    • processTestFunctionAnnotations

      protected void processTestFunctionAnnotations()
    • addTest

      protected void addTest(OptionCollectionTest.OptionTest test)
    • baseName

      protected DocumentName baseName()
      Gets the document name based on the baseDir.
      Returns:
      The document name based on the baseDir.
    • validate

      protected void validate(Collection<String> unsupportedArgs)
    • 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 IOException
      Create the report configuration from the argument pairs. There must be at least one arg. It may be ImmutablePair.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 each Pair<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

      protected File writeFile(String name, Iterable<String> lines)
    • mkDocName

      protected final DocumentName mkDocName(String name)
    • displayArgAndName

      protected final String displayArgAndName(org.apache.commons.cli.Option option, String fname)
      Display the option and value under test
    • dump

      protected final String dump(DocumentNameMatcher nameMatcher, DocumentName name)
    • 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:
      provideArguments in interface org.junit.jupiter.params.provider.ArgumentsProvider