Introduce basic unit test for AutowiredAnnotationBeanPostProcessor.processInjection()

This commit is contained in:
Sam Brannen
2024-01-05 13:22:29 +01:00
parent 534d3229fe
commit 476ef0c3ca

View File

@@ -118,6 +118,20 @@ class AutowiredAnnotationBeanPostProcessorTests {
.withRootCauseInstanceOf(IllegalStateException.class);
}
@Test
void processInjection() {
ResourceInjectionBean bean = new ResourceInjectionBean();
assertThat(bean.getTestBean()).isNull();
assertThat(bean.getTestBean2()).isNull();
TestBean tb = new TestBean();
bf.registerSingleton("testBean", tb);
bpp.processInjection(bean);
assertThat(bean.getTestBean()).isSameAs(tb);
assertThat(bean.getTestBean2()).isSameAs(tb);
}
@Test
void resourceInjection() {
RootBeanDefinition bd = new RootBeanDefinition(ResourceInjectionBean.class);