Skip to content

Commit a13e9ba

Browse files
committed
Fix long running unit tests
Fixes #403 Signed-off-by: Gary O'Neall <gary@sourceauditor.com>
1 parent 0230dc2 commit a13e9ba

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

src/test/java/org/spdx/utility/compare/LicenseCompareHelperTest.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,7 @@
2222
import java.io.File;
2323
import java.io.IOException;
2424
import java.io.StringReader;
25-
import java.util.Arrays;
26-
import java.util.Collection;
27-
import java.util.HashMap;
28-
import java.util.HashSet;
29-
import java.util.List;
30-
import java.util.Map;
31-
import java.util.Objects;
25+
import java.util.*;
3226

3327
import org.spdx.core.DefaultModelStore;
3428
import org.spdx.core.IModelCopyManager;
@@ -777,16 +771,17 @@ public void testMatchingStandardLicenseExceptionIdsWithinText() throws InvalidSP
777771
String gpl20WithClasspathException20 = gpl20 + "\n\n" + classpathException20;
778772
String textWithRandomPrefixAndSuffix = "Some random preamble text.\n\n" + classpathException20 + "\n\nSome random epilogue text.";
779773

780-
List<String> expectedResultEmpty = Arrays.asList();
781-
List<String> expectedResultClasspathException20 = Arrays.asList("Classpath-exception-2.0");
774+
List<String> expectedResultEmpty = Collections.emptyList();
775+
List<String> classPathException20Only = Collections.singletonList("Classpath-exception-2.0");
776+
List<String> expectedResultClasspathException20 = Arrays.asList("Classpath-exception-2.0", "Classpath-exception-2.0-short");
782777

783778
// Note: be cautious about adding too many assertions to this test, as LicenseCompareHelper.matchingStandardLicenseExceptionIdsWithinText can have lengthy runtimes
784779
assertListsEqual(expectedResultEmpty, LicenseCompareHelper.matchingStandardLicenseExceptionIdsWithinText(null));
785780
assertListsEqual(expectedResultEmpty, LicenseCompareHelper.matchingStandardLicenseExceptionIdsWithinText(""));
786781
assertListsEqual(expectedResultEmpty, LicenseCompareHelper.matchingStandardLicenseExceptionIdsWithinText("Some random text that isn't a standard license exception"));
787782

788783
// Tests for the 2-arg version of matchingStandardLicenseExceptionIdsWithinText (which is faster than the 1-arg version)
789-
assertListsEqual(expectedResultClasspathException20, LicenseCompareHelper.matchingStandardLicenseExceptionIdsWithinText(gpl20WithClasspathException20, Arrays.asList("Classpath-exception-2.0")));
784+
assertListsEqual(classPathException20Only, LicenseCompareHelper.matchingStandardLicenseExceptionIdsWithinText(gpl20WithClasspathException20, classPathException20Only));
790785

791786
if (UnitTestHelper.runSlowTests()) {
792787
assertListsEqual(expectedResultClasspathException20, LicenseCompareHelper.matchingStandardLicenseExceptionIdsWithinText(classpathException20));

0 commit comments

Comments
 (0)