File tree Expand file tree Collapse file tree 2 files changed +1
-14
lines changed
spring-boot-project/spring-boot-test/src
main/java/org/springframework/boot/test/mock/mockito
test/java/org/springframework/boot/test/mock/mockito Expand file tree Collapse file tree 2 files changed +1
-14
lines changed Original file line number Diff line number Diff line change @@ -252,12 +252,11 @@ private Set<String> getExistingBeans(ConfigurableListableBeanFactory beanFactory
252252 Set <String > beans = new LinkedHashSet <>(
253253 Arrays .asList (beanFactory .getBeanNamesForType (resolvableType , true , false )));
254254 Class <?> type = resolvableType .resolve (Object .class );
255- String typeName = type .getName ();
256255 for (String beanName : beanFactory .getBeanNamesForType (FactoryBean .class , true , false )) {
257256 beanName = BeanFactoryUtils .transformedBeanName (beanName );
258257 BeanDefinition beanDefinition = beanFactory .getBeanDefinition (beanName );
259258 Object attribute = beanDefinition .getAttribute (FactoryBean .OBJECT_TYPE_ATTRIBUTE );
260- if (resolvableType .equals (attribute ) || type .equals (attribute ) || typeName . equals ( attribute ) ) {
259+ if (resolvableType .equals (attribute ) || type .equals (attribute )) {
261260 beans .add (beanName );
262261 }
263262 }
Original file line number Diff line number Diff line change @@ -73,18 +73,6 @@ void cannotMockMultipleQualifiedBeans() {
7373 + " expected a single matching bean to replace but found [example1, example3]" );
7474 }
7575
76- @ Test
77- void canMockBeanProducedByFactoryBeanWithStringObjectTypeAttribute () {
78- AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext ();
79- MockitoPostProcessor .register (context );
80- RootBeanDefinition factoryBeanDefinition = new RootBeanDefinition (TestFactoryBean .class );
81- factoryBeanDefinition .setAttribute (FactoryBean .OBJECT_TYPE_ATTRIBUTE , SomeInterface .class .getName ());
82- context .registerBeanDefinition ("beanToBeMocked" , factoryBeanDefinition );
83- context .register (MockedFactoryBean .class );
84- context .refresh ();
85- assertThat (Mockito .mockingDetails (context .getBean ("beanToBeMocked" )).isMock ()).isTrue ();
86- }
87-
8876 @ Test
8977 void canMockBeanProducedByFactoryBeanWithClassObjectTypeAttribute () {
9078 AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext ();
You can’t perform that action at this time.
0 commit comments