@ -418,6 +418,16 @@ class InstanceSupplierCodeGeneratorTests {
compileAndCheckWarnings ( beanDefinition ) ;
compileAndCheckWarnings ( beanDefinition ) ;
}
}
@Test
void generateWhenTargetFactoryMethodIsProtectedAndReturnTypeIsDeprecated ( ) {
BeanDefinition beanDefinition = BeanDefinitionBuilder
. rootBeanDefinition ( DeprecatedBean . class )
. setFactoryMethodOnBean ( "deprecatedReturnTypeProtected" , "config" ) . getBeanDefinition ( ) ;
beanFactory . registerBeanDefinition ( "config" , BeanDefinitionBuilder
. genericBeanDefinition ( DeprecatedMemberConfiguration . class ) . getBeanDefinition ( ) ) ;
compileAndCheckWarnings ( beanDefinition ) ;
}
private void compileAndCheckWarnings ( BeanDefinition beanDefinition ) {
private void compileAndCheckWarnings ( BeanDefinition beanDefinition ) {
assertThatNoException ( ) . isThrownBy ( ( ) - > compile ( TEST_COMPILER , beanDefinition ,
assertThatNoException ( ) . isThrownBy ( ( ) - > compile ( TEST_COMPILER , beanDefinition ,
( ( instanceSupplier , compiled ) - > { } ) ) ) ;
( ( instanceSupplier , compiled ) - > { } ) ) ) ;
@ -464,6 +474,26 @@ class InstanceSupplierCodeGeneratorTests {
compileAndCheckWarnings ( beanDefinition ) ;
compileAndCheckWarnings ( beanDefinition ) ;
}
}
@Test
void generateWhenTargetFactoryMethodReturnTypeIsDeprecatedForRemoval ( ) {
BeanDefinition beanDefinition = BeanDefinitionBuilder
. rootBeanDefinition ( DeprecatedForRemovalBean . class )
. setFactoryMethodOnBean ( "deprecatedReturnType" , "config" ) . getBeanDefinition ( ) ;
beanFactory . registerBeanDefinition ( "config" , BeanDefinitionBuilder
. genericBeanDefinition ( DeprecatedForRemovalMemberConfiguration . class ) . getBeanDefinition ( ) ) ;
compileAndCheckWarnings ( beanDefinition ) ;
}
@Test
void generateWhenTargetFactoryMethodIsProtectedAndReturnTypeIsDeprecatedForRemoval ( ) {
BeanDefinition beanDefinition = BeanDefinitionBuilder
. rootBeanDefinition ( DeprecatedForRemovalBean . class )
. setFactoryMethodOnBean ( "deprecatedReturnTypeProtected" , "config" ) . getBeanDefinition ( ) ;
beanFactory . registerBeanDefinition ( "config" , BeanDefinitionBuilder
. genericBeanDefinition ( DeprecatedForRemovalMemberConfiguration . class ) . getBeanDefinition ( ) ) ;
compileAndCheckWarnings ( beanDefinition ) ;
}
private void compileAndCheckWarnings ( BeanDefinition beanDefinition ) {
private void compileAndCheckWarnings ( BeanDefinition beanDefinition ) {
assertThatNoException ( ) . isThrownBy ( ( ) - > compile ( TEST_COMPILER , beanDefinition ,
assertThatNoException ( ) . isThrownBy ( ( ) - > compile ( TEST_COMPILER , beanDefinition ,
( ( instanceSupplier , compiled ) - > { } ) ) ) ;
( ( instanceSupplier , compiled ) - > { } ) ) ) ;