Polish "Introduce TestSliceTestContextBootstrapper for test slices"

See gh-44354
This commit is contained in:
Andy Wilkinson 2025-07-02 13:25:16 +01:00
parent a42ba82fea
commit 53464f22e7
20 changed files with 25 additions and 24 deletions

View File

@ -14,10 +14,11 @@
* limitations under the License.
*/
package org.springframework.boot.test.context;
package org.springframework.boot.test.autoconfigure;
import java.lang.annotation.Annotation;
import org.springframework.boot.test.context.SpringBootTestContextBootstrapper;
import org.springframework.core.ResolvableType;
import org.springframework.core.annotation.MergedAnnotation;
import org.springframework.core.annotation.MergedAnnotations;
@ -27,18 +28,18 @@ import org.springframework.test.context.TestContextBootstrapper;
import org.springframework.util.Assert;
/**
* {@link TestContextBootstrapper} for test slices support.
* Base class for test slice {@link TestContextBootstrapper test context bootstrappers}.
*
* @param <T> the test slice annotation
* @author Yanming Zhou
* @since 3.5.0
* @since 4.0.0
*/
public class TestSliceTestContextBootstrapper<T extends Annotation> extends SpringBootTestContextBootstrapper {
public abstract class TestSliceTestContextBootstrapper<T extends Annotation> extends SpringBootTestContextBootstrapper {
private final Class<T> annotationType;
@SuppressWarnings("unchecked")
public TestSliceTestContextBootstrapper() {
protected TestSliceTestContextBootstrapper() {
this.annotationType = (Class<T>) ResolvableType.forClass(getClass())
.as(TestSliceTestContextBootstrapper.class)
.getGeneric(0)

View File

@ -16,7 +16,7 @@
package org.springframework.boot.test.autoconfigure.data.cassandra;
import org.springframework.boot.test.context.TestSliceTestContextBootstrapper;
import org.springframework.boot.test.autoconfigure.TestSliceTestContextBootstrapper;
import org.springframework.test.context.TestContextBootstrapper;
/**

View File

@ -16,7 +16,7 @@
package org.springframework.boot.test.autoconfigure.data.couchbase;
import org.springframework.boot.test.context.TestSliceTestContextBootstrapper;
import org.springframework.boot.test.autoconfigure.TestSliceTestContextBootstrapper;
import org.springframework.test.context.TestContextBootstrapper;
/**

View File

@ -16,7 +16,7 @@
package org.springframework.boot.test.autoconfigure.data.elasticsearch;
import org.springframework.boot.test.context.TestSliceTestContextBootstrapper;
import org.springframework.boot.test.autoconfigure.TestSliceTestContextBootstrapper;
import org.springframework.test.context.TestContextBootstrapper;
/**

View File

@ -16,7 +16,7 @@
package org.springframework.boot.test.autoconfigure.data.jdbc;
import org.springframework.boot.test.context.TestSliceTestContextBootstrapper;
import org.springframework.boot.test.autoconfigure.TestSliceTestContextBootstrapper;
import org.springframework.test.context.TestContextBootstrapper;
/**

View File

@ -16,7 +16,7 @@
package org.springframework.boot.test.autoconfigure.data.ldap;
import org.springframework.boot.test.context.TestSliceTestContextBootstrapper;
import org.springframework.boot.test.autoconfigure.TestSliceTestContextBootstrapper;
import org.springframework.test.context.TestContextBootstrapper;
/**

View File

@ -16,7 +16,7 @@
package org.springframework.boot.test.autoconfigure.data.mongo;
import org.springframework.boot.test.context.TestSliceTestContextBootstrapper;
import org.springframework.boot.test.autoconfigure.TestSliceTestContextBootstrapper;
import org.springframework.test.context.TestContextBootstrapper;
/**

View File

@ -16,7 +16,7 @@
package org.springframework.boot.test.autoconfigure.data.neo4j;
import org.springframework.boot.test.context.TestSliceTestContextBootstrapper;
import org.springframework.boot.test.autoconfigure.TestSliceTestContextBootstrapper;
import org.springframework.test.context.TestContextBootstrapper;
/**

View File

@ -16,7 +16,7 @@
package org.springframework.boot.test.autoconfigure.data.r2dbc;
import org.springframework.boot.test.context.TestSliceTestContextBootstrapper;
import org.springframework.boot.test.autoconfigure.TestSliceTestContextBootstrapper;
import org.springframework.test.context.TestContextBootstrapper;
/**

View File

@ -16,7 +16,7 @@
package org.springframework.boot.test.autoconfigure.data.redis;
import org.springframework.boot.test.context.TestSliceTestContextBootstrapper;
import org.springframework.boot.test.autoconfigure.TestSliceTestContextBootstrapper;
import org.springframework.test.context.TestContextBootstrapper;
/**

View File

@ -16,7 +16,7 @@
package org.springframework.boot.test.autoconfigure.graphql;
import org.springframework.boot.test.context.TestSliceTestContextBootstrapper;
import org.springframework.boot.test.autoconfigure.TestSliceTestContextBootstrapper;
import org.springframework.test.context.TestContextBootstrapper;
/**

View File

@ -16,7 +16,7 @@
package org.springframework.boot.test.autoconfigure.jdbc;
import org.springframework.boot.test.context.TestSliceTestContextBootstrapper;
import org.springframework.boot.test.autoconfigure.TestSliceTestContextBootstrapper;
import org.springframework.test.context.TestContextBootstrapper;
/**

View File

@ -16,7 +16,7 @@
package org.springframework.boot.test.autoconfigure.jooq;
import org.springframework.boot.test.context.TestSliceTestContextBootstrapper;
import org.springframework.boot.test.autoconfigure.TestSliceTestContextBootstrapper;
import org.springframework.test.context.TestContextBootstrapper;
/**

View File

@ -16,7 +16,7 @@
package org.springframework.boot.test.autoconfigure.json;
import org.springframework.boot.test.context.TestSliceTestContextBootstrapper;
import org.springframework.boot.test.autoconfigure.TestSliceTestContextBootstrapper;
import org.springframework.test.context.TestContextBootstrapper;
/**

View File

@ -16,7 +16,7 @@
package org.springframework.boot.test.autoconfigure.orm.jpa;
import org.springframework.boot.test.context.TestSliceTestContextBootstrapper;
import org.springframework.boot.test.autoconfigure.TestSliceTestContextBootstrapper;
import org.springframework.test.context.TestContextBootstrapper;
/**

View File

@ -16,7 +16,7 @@
package org.springframework.boot.test.autoconfigure.web.client;
import org.springframework.boot.test.context.TestSliceTestContextBootstrapper;
import org.springframework.boot.test.autoconfigure.TestSliceTestContextBootstrapper;
import org.springframework.test.context.TestContextBootstrapper;
/**

View File

@ -16,8 +16,8 @@
package org.springframework.boot.test.autoconfigure.web.reactive;
import org.springframework.boot.test.autoconfigure.TestSliceTestContextBootstrapper;
import org.springframework.boot.test.context.ReactiveWebMergedContextConfiguration;
import org.springframework.boot.test.context.TestSliceTestContextBootstrapper;
import org.springframework.test.context.MergedContextConfiguration;
import org.springframework.test.context.TestContextBootstrapper;

View File

@ -16,7 +16,7 @@
package org.springframework.boot.test.autoconfigure.web.servlet;
import org.springframework.boot.test.context.TestSliceTestContextBootstrapper;
import org.springframework.boot.test.autoconfigure.TestSliceTestContextBootstrapper;
import org.springframework.test.context.MergedContextConfiguration;
import org.springframework.test.context.TestContextBootstrapper;
import org.springframework.test.context.web.WebMergedContextConfiguration;

View File

@ -16,7 +16,7 @@
package org.springframework.boot.test.autoconfigure.webservices.client;
import org.springframework.boot.test.context.TestSliceTestContextBootstrapper;
import org.springframework.boot.test.autoconfigure.TestSliceTestContextBootstrapper;
import org.springframework.test.context.TestContextBootstrapper;
/**

View File

@ -16,7 +16,7 @@
package org.springframework.boot.test.autoconfigure.webservices.server;
import org.springframework.boot.test.context.TestSliceTestContextBootstrapper;
import org.springframework.boot.test.autoconfigure.TestSliceTestContextBootstrapper;
import org.springframework.test.context.MergedContextConfiguration;
import org.springframework.test.context.TestContextBootstrapper;
import org.springframework.test.context.web.WebMergedContextConfiguration;