Class TestingLicense

java.lang.Object
org.apache.rat.testhelpers.TestingLicense
All Implemented Interfaces:
Comparable<ILicense>, IHeaderMatcher, ILicense

public class TestingLicense extends Object implements ILicense
A class to quickly build testing licenses.
  • Constructor Details

    • TestingLicense

      public TestingLicense(String id)
      Creates a testing license with the specified id and a default TestingMatcher
      Parameters:
      id - the id to use.
      See Also:
    • TestingLicense

      public TestingLicense(String family, String id)
      Creates a testing license with the specified id and a default TestingMatcher
      Parameters:
      family - the Family id.
      id - the id to use.
      See Also:
    • TestingLicense

      public TestingLicense(String family, String id, IHeaderMatcher matcher)
      Creates a testing license with the specified id and matcher.
      Parameters:
      id - the id to use.
      matcher - the matcher to execute.
    • TestingLicense

      public TestingLicense(String id, IHeaderMatcher matcher, ILicenseFamily family)
      Creates a testing license with the specified matcher and family.
      Parameters:
      id - the license id to use.
      matcher - the matcher to use.
      family - the family for this license.
  • Method Details

    • getFamily

      public ILicenseFamily getFamily()
      Gets the family from the license.
      Returns:
      the license family.
    • getMatcher

      public IHeaderMatcher getMatcher()
      Gets the matcher from the license.
      Specified by:
      getMatcher in interface ILicense
      Returns:
      the matcher.
    • setName

      public void setName(String name)
      Sets the name from value for this license.
      Parameters:
      name - the name of this license.
    • getId

      public String getId()
      Description copied from interface: IHeaderMatcher
      Get the identifier for this matcher.

      All matchers must have unique identifiers

      Specified by:
      getId in interface IHeaderMatcher
      Returns:
      the identifier for this matcher.
    • reset

      public void reset()
      Description copied from interface: IHeaderMatcher
      Resets this state of this matcher to its initial state in preparation for use with another document scan. In most cases this method does not need to do anything.
      Specified by:
      reset in interface IHeaderMatcher
    • matches

      public boolean matches(IHeaders line)
      Description copied from interface: IHeaderMatcher
      Attempts to match text in the IHeaders instance.
      Specified by:
      matches in interface IHeaderMatcher
      Parameters:
      line - the representations of the headers to check
      Returns:
      true if the matcher matches the text, false otherwise.
    • getLicenseFamily

      public ILicenseFamily getLicenseFamily()
      Description copied from interface: ILicense
      Gets the license family.
      Specified by:
      getLicenseFamily in interface ILicense
      Returns:
      the ILicenseFamily implementation for this license.
    • getNote

      public String getNote()
      Description copied from interface: ILicense
      Gets the note associated with the license.
      Specified by:
      getNote in interface ILicense
      Returns:
      the note associated with this license. May be null or empty.
    • getName

      public String getName()
      Description copied from interface: ILicense
      Returns the name of this license. If no name was specified then the name of the family is returned.
      Specified by:
      getName in interface ILicense
      Returns:
      the name of this license.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object