|
53 | 53 | class TestBeanOverrideProcessor implements BeanOverrideProcessor {
|
54 | 54 |
|
55 | 55 | /**
|
56 |
| - * Find a test bean factory {@link Method} in the given {@link Class} or one |
57 |
| - * of its parent classes. |
| 56 | + * Find a test bean factory {@link Method} for the given {@link Class}. |
58 | 57 | * <p>Delegates to {@link #findTestBeanFactoryMethod(Class, Class, List)}.
|
59 | 58 | */
|
60 | 59 | static Method findTestBeanFactoryMethod(Class<?> clazz, Class<?> methodReturnType, String... methodNames) {
|
61 | 60 | return findTestBeanFactoryMethod(clazz, methodReturnType, List.of(methodNames));
|
62 | 61 | }
|
63 | 62 |
|
64 | 63 | /**
|
65 |
| - * Find a test bean factory {@link Method} in the given {@link Class} or one |
66 |
| - * of its parent classes, which meets the following criteria. |
| 64 | + * Find a test bean factory {@link Method} for the given {@link Class}, which |
| 65 | + * meets the following criteria. |
67 | 66 | * <ul>
|
68 | 67 | * <li>The method is static.</li>
|
69 | 68 | * <li>The method does not accept any arguments.</li>
|
70 | 69 | * <li>The method's return type matches the supplied {@code methodReturnType}.</li>
|
71 | 70 | * <li>The method's name is one of the supplied {@code methodNames}.</li>
|
72 | 71 | * </ul>
|
73 |
| - * <p>If the test class inherits from another class, the class hierarchy is |
74 |
| - * searched for factory methods. Matching factory methods are prioritized |
75 |
| - * from closest to farthest from the test class in the class hierarchy, |
76 |
| - * provided they have the same name. However, if multiple methods are found |
77 |
| - * that match distinct candidate names, an exception is thrown. |
| 72 | + * <p>This method traverses up the type hierarchy of the given class in search |
| 73 | + * of the factory method, beginning with the class itself and then searching |
| 74 | + * implemented interfaces and superclasses. If a factory method is not found |
| 75 | + * in the type hierarchy, this method will also search on the enclosing class |
| 76 | + * if the class is a nested class. |
| 77 | + * <p>If multiple factory methods are found that match the search criteria, |
| 78 | + * an exception is thrown. |
78 | 79 | * @param clazz the class in which to search for the factory method
|
79 | 80 | * @param methodReturnType the return type for the factory method
|
80 | 81 | * @param methodNames a set of supported names for the factory method
|
|
0 commit comments