Search in sources :

Example 1 with RepositoryFactoryBeanSupport

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);
}
Also used : RepositoryFactoryBeanSupport(org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport) RepositoryFactorySupport(org.springframework.data.repository.core.support.RepositoryFactorySupport) RepositoryFactoryCustomizer(org.springframework.data.repository.core.support.RepositoryFactoryCustomizer) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)1 RepositoryFactoryBeanSupport (org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport)1 RepositoryFactoryCustomizer (org.springframework.data.repository.core.support.RepositoryFactoryCustomizer)1 RepositoryFactorySupport (org.springframework.data.repository.core.support.RepositoryFactorySupport)1