Class SimpleLicenseTester

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

public class SimpleLicenseTester extends Object implements ILicenseTester
Tests licenses against canonical text.
Author:
Gary O'Neall
  • Constructor Details

    • SimpleLicenseTester

      public SimpleLicenseTester(File testFileDir)
      Parameters:
      testFileDir - Directory containing license texts in the format [license-id].txt
  • Method Details

    • testException

      public static List<String> testException(org.spdx.library.model.v2.license.LicenseException exception, File compareFile) throws org.spdx.core.InvalidSPDXAnalysisException, IOException
      Throws:
      org.spdx.core.InvalidSPDXAnalysisException
      IOException
    • testLicense

      public static List<String> testLicense(org.spdx.library.model.v2.license.License license, File compareFile) throws org.spdx.core.InvalidSPDXAnalysisException, IOException
      Throws:
      org.spdx.core.InvalidSPDXAnalysisException
      IOException
    • 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.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.core.InvalidSPDXAnalysisException - on error parsing SPDX licenses
    • getLicenseTestText

      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

      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)