Polish Javadoc for BeanOverrideHandler
This commit is contained in:
@@ -44,16 +44,16 @@ class BeanOverrideContextCustomizerFactory implements ContextCustomizerFactory {
|
||||
List<ContextConfigurationAttributes> configAttributes) {
|
||||
|
||||
Set<BeanOverrideHandler> handlers = new LinkedHashSet<>();
|
||||
findBeanOverrideHandler(testClass, handlers);
|
||||
findBeanOverrideHandlers(testClass, handlers);
|
||||
if (handlers.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return new BeanOverrideContextCustomizer(handlers);
|
||||
}
|
||||
|
||||
private void findBeanOverrideHandler(Class<?> testClass, Set<BeanOverrideHandler> handlers) {
|
||||
private void findBeanOverrideHandlers(Class<?> testClass, Set<BeanOverrideHandler> handlers) {
|
||||
if (TestContextAnnotationUtils.searchEnclosingClass(testClass)) {
|
||||
findBeanOverrideHandler(testClass.getEnclosingClass(), handlers);
|
||||
findBeanOverrideHandlers(testClass.getEnclosingClass(), handlers);
|
||||
}
|
||||
BeanOverrideHandler.forTestClass(testClass).forEach(handler ->
|
||||
Assert.state(handlers.add(handler), () ->
|
||||
|
||||
@@ -51,7 +51,9 @@ import static org.springframework.core.annotation.MergedAnnotations.SearchStrate
|
||||
* unique set of metadata used to identify the bean to override. Overridden
|
||||
* {@code equals()} and {@code hashCode()} methods should also delegate to the
|
||||
* {@code super} implementations in this class in order to support the basic
|
||||
* metadata used by all bean overrides.
|
||||
* metadata used by all bean overrides. In addition, it is recommended that
|
||||
* implementations override {@code toString()} to include all relevant metadata
|
||||
* in order to enhance diagnostics.
|
||||
*
|
||||
* <p>Concrete implementations of {@code BeanOverrideHandler} can store additional
|
||||
* metadata to use during override {@linkplain #createOverrideInstance instance
|
||||
@@ -93,9 +95,11 @@ public abstract class BeanOverrideHandler {
|
||||
/**
|
||||
* Process the given {@code testClass} and build the corresponding
|
||||
* {@code BeanOverrideHandler} list derived from {@link BeanOverride @BeanOverride}
|
||||
* fields in the test class, its type hierarchy, and its enclosing class hierarchy.
|
||||
* fields in the test class and its type hierarchy.
|
||||
* <p>This method does not search the enclosing class hierarchy.
|
||||
* @param testClass the test class to process
|
||||
* @return a list of bean override handlers
|
||||
* @see org.springframework.test.context.TestContextAnnotationUtils#searchEnclosingClass(Class)
|
||||
*/
|
||||
public static List<BeanOverrideHandler> forTestClass(Class<?> testClass) {
|
||||
List<BeanOverrideHandler> handlers = new LinkedList<>();
|
||||
|
||||
Reference in New Issue
Block a user