Class LicenseTester

java.lang.Object
org.spdx.licenselistpublisher.licensegenerator.LicenseTester
All Implemented Interfaces:
ILicenseTester

public class LicenseTester extends Object implements ILicenseTester
Test SPDX licenses against a directory of test licenses. The directory of test licenses contains license text with the following file naming convention: {license-id}/(license|header|exception)/(good|bad)/{test-id}.txt
Author:
Gary O'Neall
  • Constructor Details

    • LicenseTester

      public LicenseTester(File licenseTestDirectory)
      Parameters:
      licenseTestDirectory - Directory of license text files for comparison in the form {license-id}/(license|header|exception)/(good|bad)/{test-id}.txt
  • Method Details

    • testLicense

      public List<String> testLicense(ListedLicenseContainer licenseContainer) throws IOException, org.spdx.utility.compare.SpdxCompareException, org.spdx.core.InvalidSPDXAnalysisException
      Test a license against the license test files
      Specified by:
      testLicense in interface ILicenseTester
      Parameters:
      licenseContainer - license to test
      license - license to test
      Returns:
      list of test failure descriptions. List is empty if all tests pass.
      Throws:
      IOException
      org.spdx.utility.compare.SpdxCompareException
      org.spdx.core.InvalidSPDXAnalysisException
    • testException

      public List<String> testException(ListedExceptionContainer exceptionContainer) throws IOException, org.spdx.core.InvalidSPDXAnalysisException
      Test exception against the test files directory
      Specified by:
      testException in interface ILicenseTester
      Parameters:
      exceptionContainer -
      exception -
      Returns:
      Throws:
      IOException
      org.spdx.core.InvalidSPDXAnalysisException
    • getLicenseTestText

      public String getLicenseTestText(String licenseId) throws IOException
      Specified by:
      getLicenseTestText in interface ILicenseTester
      Parameters:
      licenseId -
      Returns:
      text for the test for a license ID, null if no license text is found
      Throws:
      IOException
    • getExceptionTestText

      public String getExceptionTestText(String licenseExceptionId) throws IOException
      Specified by:
      getExceptionTestText in interface ILicenseTester
      Parameters:
      licenseExceptionId -
      Returns:
      text for the test for a exception ID, null if no license text is found
      Throws:
      IOException