Class CombinedLicenseTester

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

public class CombinedLicenseTester extends Object implements ILicenseTester
Combines a simple license tester and the standard license tester into a single tester
  • Constructor Details

    • CombinedLicenseTester

      public CombinedLicenseTester(File simpleLicenseTestDir, File licenseTestDir)
      Create a license tester that will test both simple licenses and standard licenses
      Parameters:
      simpleLicenseTestDir - Directory containing license texts in the format [license-id].txt
      licenseTestDir - Directory of license text files for comparison in the form {license-id}/(license|header|exception)/(good|bad)/{test-id}.txt
  • Method Details

    • testException

      public List<String> testException(ListedExceptionContainer exceptionContainer) throws IOException, org.spdx.core.InvalidSPDXAnalysisException
      Description copied from interface: ILicenseTester
      Test exception against the test files directory
      Specified by:
      testException in interface ILicenseTester
      Parameters:
      exceptionContainer - Exception to test
      Returns:
      list of test failure descriptions. List is empty if all tests pass.
      Throws:
      IOException - on I/O error reading test file(s)
      org.spdx.core.InvalidSPDXAnalysisException - on error parsing SPDX licenses
    • testLicense

      public List<String> testLicense(ListedLicenseContainer licenseContainer) throws IOException, org.spdx.utility.compare.SpdxCompareException, org.spdx.core.InvalidSPDXAnalysisException
      Description copied from interface: ILicenseTester
      Test a license against the license test files
      Specified by:
      testLicense in interface ILicenseTester
      Parameters:
      licenseContainer - license to test
      Returns:
      list of test failure descriptions. List is empty if all tests pass.
      Throws:
      IOException - on I/O error reading test file(s)
      org.spdx.utility.compare.SpdxCompareException - on error executing the compare
      org.spdx.core.InvalidSPDXAnalysisException - on error parsing SPDX licenses
    • getLicenseTestText

      @Nullable public String getLicenseTestText(String licenseId) throws IOException
      Specified by:
      getLicenseTestText in interface ILicenseTester
      Parameters:
      licenseId - license ID for the license text
      Returns:
      text for the test for a license ID, null if no license text is found
      Throws:
      IOException - on I/O error reading test file(s)
    • getExceptionTestText

      @Nullable public String getExceptionTestText(String licenseExceptionId) throws IOException
      Specified by:
      getExceptionTestText in interface ILicenseTester
      Parameters:
      licenseExceptionId - license exception text
      Returns:
      text for the test for an exception ID, null if no license text is found
      Throws:
      IOException - on I/O error reading test file(s)