Class ExpandTestFinder


public class ExpandTestFinder extends TagTestFinder
This class allows a new tag "@expand" which allows a single test description to be expanded into multiple test descriptions using variable substitution. Variables are declared in the .jte file.

The list of valid entries is identical to those found for JCK. There is no list of pre-defined keywords. If keyword checking is needed, then the list of allowed keywords must be provided via the -allowKeyword option.

See Also:
  • Constructor Details

    • ExpandTestFinder

      public ExpandTestFinder()
  • Method Details

    • decodeArg

      protected int decodeArg(String[] args, int i) throws TestFinder.Fault
      Description copied from class: TagTestFinder
      Decode the arg at a specified position in the arg array. If overridden by a subtype, the subtype should try and decode any arg it recognizes, and then call super.decodeArg to give the superclass(es) a chance to recognize any arguments.
      Overrides:
      decodeArg in class TagTestFinder
      Parameters:
      args - The array of arguments
      i - The next argument to be decoded.
      Returns:
      The number of elements consumed in the array; for example, for a simple option like "-v" the result should be 1; for an option with an argument like "-f file" the result should be 2, etc.
      Throws:
      TestFinder.Fault - If there is a problem with the value of the current arg, such as a bad value to an option, the Fault exception can be thrown. The exception should NOT be thrown if the current arg is unrecognized: in that case, an implementation should delegate the call to the supertype.
    • init

      public void init(String[] args, File testSuiteRoot, TestEnvironment env) throws TestFinder.Fault
      Description copied from class: TestFinder
      Initialize the data required by the finder. Clients creating instances of test finders should call this before allowing use of the finder. Not doing so may result in unexpected results.
      Overrides:
      init in class TestFinder
      Parameters:
      args - An array of strings specified as arguments in the environment. Null indicates no args.
      testSuiteRoot - The root file that will be passed to test descriptions read by the finder.
      env - The environment being used to run the test. May be null.
      Throws:
      TestFinder.Fault - if there is a problem interpreting any of args.
    • foundTestDescription

      protected void foundTestDescription(Map<String,String> entries, File file, int line)
      Description copied from class: TestFinder
      Report that data for a test description has been found.
      Overrides:
      foundTestDescription in class TestFinder
      Parameters:
      entries - The data for the test description
      file - The file being read
      line - The line number within the file (used for error messages)
    • processEntry

      protected void processEntry(Map<String,String> entries, String name, String value)
      Description copied from class: TestFinder
      Handle a test description entry read from a file. By default, the name-value pair is inserted into the entries dictionary; however, the method can be overridden by a subtype to adjust the name or value before putting it into the dictionary, or even to ignore/fault the pair.
      Overrides:
      processEntry in class TestFinder
      Parameters:
      entries - The dictionary of the entries being read
      name - The name of the entry that has been read
      value - The value of the entry that has been read