Skip to content

Commit

Permalink
Replaced usage of List.of as this is not available (in yet still supp…
Browse files Browse the repository at this point in the history
…orted) JDK 8 (#270)
  • Loading branch information
ohecker authored Jun 11, 2024
1 parent 6096d2a commit 7f25bc7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.util.List;
import java.util.Collections;

import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
Expand Down Expand Up @@ -161,7 +161,7 @@ protected ComponentInfoCuration fetchCurationFromRepository(String effectiveCura
CopyrightCuration cc = new CopyrightCuration();
cc.setOperation(CurationOperation.ADD);
cc.setNewCopyright("Copyright " + effectiveCurationDataSelector + " " + pathFragmentWithinRepo);
cic.setCopyrightCurations(List.of(cc));
cic.setCopyrightCurations(Collections.singletonList(cc));
return cic;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -63,38 +65,38 @@ void testMerge() {
curationFirst.setName("firstName");
curationFirst.setNote("firstNote");
curationFirst.setUrl("firstUrl");
curationFirst.setExcludedPaths(List.of("first path"));
curationFirst.setCopyrights(List.of("first copyright 1", "first copyright 2"));
curationFirst.setExcludedPaths(Collections.singletonList("first path"));
curationFirst.setCopyrights(Arrays.asList(new String[] { "first copyright 1", "first copyright 2" }));
LicenseInfoCuration licFirst = new LicenseInfoCuration();
curationFirst.setLicenses(List.of(licFirst));
curationFirst.setLicenses(Collections.singletonList(licFirst));
CopyrightCuration ccFirst = new CopyrightCuration();
curationFirst.setCopyrightCurations(List.of(ccFirst));
curationFirst.setCopyrightCurations(Collections.singletonList(ccFirst));
LicenseCuration lcFirst = new LicenseCuration();
curationFirst.setLicenseCurations(List.of(lcFirst));
curationFirst.setLicenseCurations(Collections.singletonList(lcFirst));

ComponentInfoCuration curationSecond = new ComponentInfoCuration();
curationSecond.setName("secondName");
curationSecond.setNote("secondNote");
curationSecond.setUrl("secondUrl");
curationSecond.setExcludedPaths(List.of("second path"));
curationSecond.setCopyrights(List.of("second copyright 1", "second copyright 2"));
curationSecond.setExcludedPaths(Collections.singletonList("second path"));
curationSecond.setCopyrights(Arrays.asList(new String[] { "second copyright 1", "second copyright 2" }));
LicenseInfoCuration licSecond = new LicenseInfoCuration();
curationSecond.setLicenses(List.of(licSecond));
curationSecond.setLicenses(Collections.singletonList(licSecond));
CopyrightCuration ccSecond = new CopyrightCuration();
curationSecond.setCopyrightCurations(List.of(ccSecond));
curationSecond.setCopyrightCurations(Collections.singletonList(ccSecond));
LicenseCuration lcSecond = new LicenseCuration();
curationSecond.setLicenseCurations(List.of(lcSecond));
curationSecond.setLicenseCurations(Collections.singletonList(lcSecond));

ComponentInfoCuration merged = CurationUtil.merge(curationFirst, curationSecond);
assertEquals("secondName", merged.getName());
assertTrue(merged.getNote().startsWith("secondNote"));
assertTrue(merged.getNote().contains("/"));
assertTrue(merged.getNote().endsWith("firstNote"));
assertEquals("secondUrl", merged.getUrl());
assertTrue(merged.getCopyrights()
.equals(List.of("second copyright 1", "second copyright 2", "first copyright 1", "first copyright 2")));
assertTrue(merged.getLicenses().equals(List.of(licSecond, licFirst)));
assertTrue(merged.getExcludedPaths().equals(List.of("second path", "first path")));
assertTrue(merged.getCopyrights().equals(Arrays.asList(
new String[] { "second copyright 1", "second copyright 2", "first copyright 1", "first copyright 2" })));
assertTrue(merged.getLicenses().equals(Arrays.asList(new LicenseInfoCuration[] { licSecond, licFirst })));
assertTrue(merged.getExcludedPaths().equals(Arrays.asList(new String[] { "second path", "first path" })));
assertTrue(merged.getLicenseCurations().equals(List.of(lcSecond, lcFirst)));
assertTrue(merged.getCopyrightCurations().equals(List.of(ccSecond, ccFirst)));
}
Expand Down
3 changes: 3 additions & 0 deletions documentation/master-solicitor.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -1895,6 +1895,9 @@ Spring beans implementing this interface will be called at certain points in the

[appendix]
== Release Notes
Changes in 1.24.1::
* https://github.com/devonfw/solicitor/pull/270: Fixed an incompatibility with JDK 8.

Changes in 1.24.0::
* https://github.com/devonfw/solicitor/issues/263: Some features were pushed from deprecation stage 1 to stage 2, which means they do not longer work with default configuration: repoType attribute, npm and npm-license-crawler readers, REGEX prefix notation, LicenseAssignmentProject.xls. See <<List of Deprecated Features>> for details.
* https://github.com/devonfw/solicitor/pull/265: Added some license name mappings.
Expand Down

0 comments on commit 7f25bc7

Please sign in to comment.