File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
spring-test/src/main/java/org/springframework/test/context/aot Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 1717package org .springframework .test .context .aot ;
1818
1919import java .lang .annotation .Annotation ;
20+ import java .nio .file .Files ;
2021import java .nio .file .Path ;
2122import java .util .Arrays ;
2223import java .util .Comparator ;
@@ -103,9 +104,7 @@ class TestClassScanner {
103104 * @param classpathRoots the classpath roots to scan
104105 */
105106 TestClassScanner (Set <Path > classpathRoots ) {
106- Assert .notEmpty (classpathRoots , "'classpathRoots' must not be null or empty" );
107- Assert .noNullElements (classpathRoots , "'classpathRoots' must not contain null elements" );
108- this .classpathRoots = classpathRoots ;
107+ this .classpathRoots = assertPreconditions (classpathRoots );
109108 }
110109
111110
@@ -207,4 +206,13 @@ private static boolean isGenericSpringTestClass(Class<?> clazz) {
207206 mergedAnnotations .isPresent (BootstrapWith .class ));
208207 }
209208
209+
210+ private static Set <Path > assertPreconditions (Set <Path > classpathRoots ) {
211+ Assert .notEmpty (classpathRoots , "'classpathRoots' must not be null or empty" );
212+ Assert .noNullElements (classpathRoots , "'classpathRoots' must not contain null elements" );
213+ classpathRoots .forEach (classpathRoot -> Assert .isTrue (Files .exists (classpathRoot ),
214+ () -> "Classpath root [%s] does not exist" .formatted (classpathRoot )));
215+ return classpathRoots ;
216+ }
217+
210218}
You can’t perform that action at this time.
0 commit comments