use of org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport in project spring-boot by spring-projects.
the class MetricsRepositoryMethodInvocationListenerBeanPostProcessorTests method postProcessBeforeInitializationWhenRepositoryFactoryBeanSupportAddsListener.
@Test
@SuppressWarnings("rawtypes")
void postProcessBeforeInitializationWhenRepositoryFactoryBeanSupportAddsListener() {
RepositoryFactoryBeanSupport bean = mock(RepositoryFactoryBeanSupport.class);
Object result = this.postProcessor.postProcessBeforeInitialization(bean, "name");
assertThat(result).isSameAs(bean);
ArgumentCaptor<RepositoryFactoryCustomizer> customizer = ArgumentCaptor.forClass(RepositoryFactoryCustomizer.class);
then(bean).should().addRepositoryFactoryCustomizer(customizer.capture());
RepositoryFactorySupport repositoryFactory = mock(RepositoryFactorySupport.class);
customizer.getValue().customize(repositoryFactory);
then(repositoryFactory).should().addInvocationListener(this.listener);
}
Aggregations