Skip to content

Commit 7b65cc3

Browse files
committed
Test getId for listed licenses
1 parent fceaa22 commit 7b65cc3

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

src/test/java/org/spdx/library/ListedLicensesTest.java

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,25 @@ public void testGetLicenseIdProperty() throws InvalidSPDXAnalysisException {
158158
assertEquals(id, idProp.get());
159159
}
160160

161-
public void testGetExceptionIdProperty() throws InvalidSPDXAnalysisException {
162-
String id = "Classpath-exception-2.0";
163-
org.spdx.library.model.v2.license.ListedLicenseException ex = ListedLicenses.getListedLicenses().getListedExceptionByIdCompatV2(id);
164-
Optional<Object> idProp = ex.getModelStore().getValue(
165-
CompatibleModelStoreWrapper.documentUriIdToUri(ex.getDocumentUri(), id, false), SpdxConstantsCompatV2.PROP_LICENSE_EXCEPTION_ID);
166-
assertTrue(idProp.isPresent());
167-
assertTrue(idProp.get() instanceof String);
168-
assertEquals(id, idProp.get());
169-
}
161+
public void testGetExceptionIdProperty() throws InvalidSPDXAnalysisException {
162+
String id = "Classpath-exception-2.0";
163+
org.spdx.library.model.v2.license.ListedLicenseException ex = ListedLicenses.getListedLicenses().getListedExceptionByIdCompatV2(id);
164+
Optional<Object> idProp = ex.getModelStore().getValue(
165+
CompatibleModelStoreWrapper.documentUriIdToUri(ex.getDocumentUri(), id, false), SpdxConstantsCompatV2.PROP_LICENSE_EXCEPTION_ID);
166+
assertTrue(idProp.isPresent());
167+
assertTrue(idProp.get() instanceof String);
168+
assertEquals(id, idProp.get());
169+
}
170+
171+
public void testGetIdV2() throws InvalidSPDXAnalysisException {
172+
String id = "Apache-2.0";
173+
SpdxListedLicense lic = ListedLicenses.getListedLicenses().getListedLicenseByIdCompatV2(id);
174+
assertEquals(id, lic.getId());
175+
}
176+
177+
public void testGetIdV3() throws InvalidSPDXAnalysisException {
178+
String id = "Apache-2.0";
179+
ListedLicense lic = ListedLicenses.getListedLicenses().getListedLicenseById(id);
180+
assertEquals(id, lic.getId());
181+
}
170182
}

0 commit comments

Comments
 (0)