Class LicenseTester
java.lang.Object
org.spdx.licenselistpublisher.licensegenerator.LicenseTester
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetExceptionTestText(String licenseExceptionId) getLicenseTestText(String licenseId) testException(ListedExceptionContainer exceptionContainer) Test exception against the test files directorytestLicense(ListedLicenseContainer licenseContainer) Test a license against the license test files
-
Constructor Details
-
LicenseTester
- 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:
testLicensein interfaceILicenseTester- Parameters:
licenseContainer- license to testlicense- license to test- Returns:
- list of test failure descriptions. List is empty if all tests pass.
- Throws:
IOExceptionorg.spdx.utility.compare.SpdxCompareExceptionorg.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:
testExceptionin interfaceILicenseTester- Parameters:
exceptionContainer-exception-- Returns:
- Throws:
IOExceptionorg.spdx.core.InvalidSPDXAnalysisException
-
getLicenseTestText
- Specified by:
getLicenseTestTextin interfaceILicenseTester- Parameters:
licenseId-- Returns:
- text for the test for a license ID, null if no license text is found
- Throws:
IOException
-
getExceptionTestText
- Specified by:
getExceptionTestTextin interfaceILicenseTester- Parameters:
licenseExceptionId-- Returns:
- text for the test for a exception ID, null if no license text is found
- Throws:
IOException
-