in junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/MethodSelectorResolver.java [81:106]
private Resolution resolve(Context context, List<Class<?>> enclosingClasses, Class<?> testClass,
Supplier<Method> methodSupplier) {
if (!testClassPredicate.test(testClass)) {
return unresolved();
}
Method method = methodSupplier.get();
// @formatter:off
Set<Match> matches = Arrays.stream(MethodType.values())
.map(methodType -> methodType.resolve(enclosingClasses, testClass, method, context, configuration))
.filter(Optional::isPresent)
.map(Optional::get)
.map(testDescriptor -> Match.exact(testDescriptor, expansionCallback(testDescriptor)))
.collect(toSet());
// @formatter:on
if (matches.size() > 1) {
logger.warn(() -> {
Stream<TestDescriptor> testDescriptors = matches.stream().map(Match::getTestDescriptor);
return String.format(
"Possible configuration error: method [%s] resulted in multiple TestDescriptors %s. "
+ "This is typically the result of annotating a method with multiple competing annotations "
+ "such as @Test, @RepeatedTest, @ParameterizedTest, @TestFactory, etc.",
method.toGenericString(), testDescriptors.map(d -> d.getClass().getName()).collect(toList()));
});
}
return matches.isEmpty() ? unresolved() : matches(matches);
}