Class AbstractIgnoreBuilderTest

java.lang.Object
org.apache.rat.config.exclusion.fileprocessors.AbstractIgnoreBuilderTest
Direct Known Subclasses:
BazaarIgnoreBuilderTest, CVSIgnoreBuilderTest, GitIgnoreBuilderTest, HgIgnoreBuilderTest

public class AbstractIgnoreBuilderTest extends Object
The base class for FileProcessor builder tests. Provides supporting methods for creating test files and for validating results.
  • Field Details

    • tmpPath

      @TempDir(cleanup=NEVER) protected Path tmpPath
    • baseName

      protected DocumentName baseName
  • Constructor Details

    • AbstractIgnoreBuilderTest

      public AbstractIgnoreBuilderTest()
  • Method Details

    • setup

      @BeforeEach protected void setup()
    • writeFile

      protected File writeFile(String name, Iterable<String> lines) throws IOException
      Writes a text file to the baseDir directory.
      Parameters:
      name - the name of the file.
      lines - the lines to write to the file.
      Returns:
      the File that was written.
      Throws:
      IOException - if file cannot be created.
    • assertCorrect

      protected void assertCorrect(AbstractFileProcessorBuilder builder, Iterable<String> matching, Iterable<String> notMatching)
      Asserts the correctness of the excluder. An excluder returns false if the document name is matched.
      Parameters:
      builder - An FileProcessorBuilder that will create the excluder.
      matching - the matching strings.
      notMatching - the non-matching strings.
    • assertCorrect

      protected void assertCorrect(List<MatcherSet> matcherSets, DocumentName baseDir, Iterable<String> matching, Iterable<String> notMatching)
      Asserts the correctness of the matcher.
      Parameters:
      matcherSets - the list of matchers to create the DocumentNameMatcher from.
      baseDir - the base directory for the excluder test.
      matching - the matching strings (i.e. that should be ignored)
      notMatching - the non-matching strings (i.e. that should be checked)