File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
junit-platform-commons/src/main/java/org/junit/platform/commons/util Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 10
10
11
11
package org .junit .platform .commons .util ;
12
12
13
- import static java .util .stream .StreamSupport .stream ;
14
-
15
13
import java .util .List ;
16
14
import java .util .ServiceLoader ;
15
+ import java .util .ServiceLoader .Provider ;
17
16
18
17
import org .junit .platform .commons .JUnitException ;
19
18
import org .junit .platform .commons .support .scanning .ClasspathScanner ;
@@ -28,16 +27,17 @@ static ClasspathScanner getInstance() {
28
27
ServiceLoader <ClasspathScanner > serviceLoader = ServiceLoader .load (ClasspathScanner .class ,
29
28
ClassLoaderUtils .getDefaultClassLoader ());
30
29
31
- List <ClasspathScanner > classpathScanners = stream ( serviceLoader .spliterator (), false ).toList ();
30
+ List <Provider < ClasspathScanner >> classpathScanners = serviceLoader .stream ( ).toList ();
32
31
33
32
if (classpathScanners .size () == 1 ) {
34
- return classpathScanners .get (0 );
33
+ return classpathScanners .get (0 ). get () ;
35
34
}
36
35
37
36
if (classpathScanners .size () > 1 ) {
38
37
throw new JUnitException (
39
38
"There should not be more than one ClasspathScanner implementation present on the classpath but there were %d: %s" .formatted (
40
- classpathScanners .size (), classpathScanners ));
39
+ classpathScanners .size (),
40
+ classpathScanners .stream ().map (Provider ::type ).map (Class ::getName ).toList ()));
41
41
}
42
42
43
43
return new DefaultClasspathScanner (ClassLoaderUtils ::getDefaultClassLoader , ReflectionUtils ::tryToLoadClass );
You can’t perform that action at this time.
0 commit comments