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 Summary
Constructors Constructor Description LicenseTester(File licenseTestDirectory) -
Method Summary
Modifier and Type Method Description StringgetExceptionTestText(String licenseExceptionId)StringgetLicenseTestText(String licenseId)List<String>testException(org.spdx.library.model.license.LicenseException exception)Test exception against the test files directoryList<String>testLicense(org.spdx.library.model.license.License license)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(org.spdx.library.model.license.License license) throws IOException, org.spdx.utility.compare.SpdxCompareException, org.spdx.library.InvalidSPDXAnalysisExceptionTest a license against the license test files- Specified by:
testLicensein interfaceILicenseTester- Parameters:
license- license to test- Returns:
- list of test failure descriptions. List is empty if all tests pass.
- Throws:
IOExceptionorg.spdx.utility.compare.SpdxCompareExceptionorg.spdx.library.InvalidSPDXAnalysisException
-
testException
public List<String> testException(org.spdx.library.model.license.LicenseException exception) throws IOException, org.spdx.library.InvalidSPDXAnalysisExceptionTest exception against the test files directory- Specified by:
testExceptionin interfaceILicenseTester- Parameters:
exception-- Returns:
- Throws:
IOExceptionorg.spdx.library.InvalidSPDXAnalysisException
-
getLicenseTestText
- Specified by:
getLicenseTestTextin interfaceILicenseTester- Returns:
- text for the test for a license ID, null if no license text is found
- Throws:
IOException
-
getExceptionTestText
- Specified by:
getExceptionTestTextin interfaceILicenseTester- Returns:
- text for the test for a exception ID, null if no license text is found
- Throws:
IOException
-