mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-14 12:32:15 +00:00
URLClassLoader support for PluginFirstClassLoader (#5970)
Co-authored-by: Jesse Glick <jglick@cloudbees.com>
This commit is contained in:
1 parent
2ea1148286
commit
bccbc865e4
4 files changed
+232
-12
No files matched your search
@@ -0,0 +1,74 @@
|
||||
package hudson.util;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
import org.junit.Test;
|
||||
|
||||
public class CompoundEnumerationTest {
|
||||
|
||||
@Test
|
||||
public void smokes() {
|
||||
assertEquals(
|
||||
rangeClosed(1, 12),
|
||||
Collections.list(
|
||||
new CompoundEnumeration<>(
|
||||
Collections.enumeration(rangeClosed(1, 4)),
|
||||
Collections.enumeration(rangeClosed(5, 8)),
|
||||
Collections.enumeration(rangeClosed(9, 12)))));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void empty() {
|
||||
assertEquals(Collections.emptyList(), Collections.list(new CompoundEnumeration<>()));
|
||||
assertEquals(
|
||||
Collections.emptyList(),
|
||||
Collections.list(new CompoundEnumeration<>(Collections.emptyEnumeration())));
|
||||
assertEquals(
|
||||
Collections.emptyList(),
|
||||
Collections.list(
|
||||
new CompoundEnumeration<>(
|
||||
Collections.emptyEnumeration(), Collections.emptyEnumeration())));
|
||||
assertEquals(
|
||||
Collections.emptyList(),
|
||||
Collections.list(
|
||||
new CompoundEnumeration<>(
|
||||
Collections.emptyEnumeration(),
|
||||
Collections.emptyEnumeration(),
|
||||
Collections.emptyEnumeration())));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void gaps() {
|
||||
assertEquals(
|
||||
rangeClosed(1, 8),
|
||||
Collections.list(
|
||||
new CompoundEnumeration<>(
|
||||
Collections.emptyEnumeration(),
|
||||
Collections.enumeration(rangeClosed(1, 4)),
|
||||
Collections.enumeration(rangeClosed(5, 8)))));
|
||||
assertEquals(
|
||||
rangeClosed(1, 8),
|
||||
Collections.list(
|
||||
new CompoundEnumeration<>(
|
||||
Collections.enumeration(rangeClosed(1, 4)),
|
||||
Collections.emptyEnumeration(),
|
||||
Collections.enumeration(rangeClosed(5, 8)))));
|
||||
assertEquals(
|
||||
rangeClosed(1, 8),
|
||||
Collections.list(
|
||||
new CompoundEnumeration<>(
|
||||
Collections.enumeration(rangeClosed(1, 4)),
|
||||
Collections.enumeration(rangeClosed(5, 8)),
|
||||
Collections.emptyEnumeration())));
|
||||
}
|
||||
|
||||
private static List<Integer> rangeClosed(int startInclusive, int endInclusive) {
|
||||
return IntStream.rangeClosed(startInclusive, endInclusive)
|
||||
.boxed()
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user