AbstractDataProviderInvocationContextProvider implements TestTemplateInvocationContextProvider { @Override public Stream<TestTemplateInvocationContext> provideTestTemplateInvocationContexts(ExtensionContext context) { Method testMethod = context.getRequiredTestMethod(); return AnnotationUtils.findAnnotation(testMethod, testAnnotationClass) .map(annotation -> provideInvocationContexts(context, annotation)) .orElseThrow(() -> new ExtensionConfigurationException(String.format( "Could not find annotation '%s' on test method '%s'.", testAnnotationClass, testMethod))); } protected  AbstractDataProviderInvocationContextProvider(Class<TEST_ANNOTATION> testAnnotationClass,
            DataConverter dataConverter); protected  AbstractDataProviderInvocationContextProvider(Class<TEST_ANNOTATION> testAnnotationClass); @Override boolean supportsTestTemplate(ExtensionContext context); @Override Stream<TestTemplateInvocationContext> provideTestTemplateInvocationContexts(ExtensionContext context);  }
@Test void testProvideTestTemplateInvocationContextsShouldThrowProperExceptionIfAnnotationIsNotPresent() { when(extensionContext.getRequiredTestMethod()).thenReturn(testMethod); Exception result = assertThrows(ExtensionConfigurationException.class, () -> underTest.provideTestTemplateInvocationContexts(extensionContext)); assertThat(result).hasMessageMatching("Could not find annotation '.*' on test method '.*'\\."); }