Fix precondition check in TestClassScanner and improve Javadoc
- remove not-empty precondition check for packageNames so that the core scan() method can actually be used. - document constructor - document use case for packageNames - add test that scan's all test classes in the spring-test project - reduce logging due to the previous action item See gh-28824
This commit is contained in:
@@ -87,11 +87,22 @@ class TestClassScannerTests {
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
void scanEntireSpringTestModule() {
|
||||
assertThat(scan()).hasSizeGreaterThan(400);
|
||||
}
|
||||
|
||||
private Stream<Class<?>> scan() {
|
||||
return new TestClassScanner(classpathRoots()).scan();
|
||||
}
|
||||
|
||||
private Stream<Class<?>> scan(String... packageNames) {
|
||||
return new TestClassScanner(classpathRoots()).scan(packageNames);
|
||||
}
|
||||
|
||||
private Set<Path> classpathRoots() {
|
||||
try {
|
||||
Set<Path> classpathRoots = Set.of(
|
||||
Paths.get(getClass().getProtectionDomain().getCodeSource().getLocation().toURI()));
|
||||
return new TestClassScanner(classpathRoots).scan(packageNames);
|
||||
return Set.of(Paths.get(getClass().getProtectionDomain().getCodeSource().getLocation().toURI()));
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<Logger name="org.springframework.test.context.TestContext" level="warn" />
|
||||
<Logger name="org.springframework.test.context.TestContextManager" level="warn" />
|
||||
<Logger name="org.springframework.test.context.ContextLoaderUtils" level="warn" />
|
||||
<Logger name="org.springframework.test.context.aot" level="trace" />
|
||||
<Logger name="org.springframework.test.context.aot" level="debug" />
|
||||
<Logger name="org.springframework.test.context.cache" level="warn" />
|
||||
<Logger name="org.springframework.test.context.junit4.rules" level="warn" />
|
||||
<Logger name="org.springframework.test.context.transaction.TransactionalTestExecutionListener" level="warn" />
|
||||
|
||||
Reference in New Issue
Block a user