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
252
252
Set <String > beans = new LinkedHashSet <>(
253
253
Arrays .asList (beanFactory .getBeanNamesForType (resolvableType , true , false )));
254
254
Class <?> type = resolvableType .resolve (Object .class );
255
- String typeName = type .getName ();
256
255
for (String beanName : beanFactory .getBeanNamesForType (FactoryBean .class , true , false )) {
257
256
beanName = BeanFactoryUtils .transformedBeanName (beanName );
258
257
BeanDefinition beanDefinition = beanFactory .getBeanDefinition (beanName );
259
258
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 )) {
261
260
beans .add (beanName );
262
261
}
263
262
}
Original file line number Diff line number Diff line change @@ -73,18 +73,6 @@ void cannotMockMultipleQualifiedBeans() {
73
73
+ " expected a single matching bean to replace but found [example1, example3]" );
74
74
}
75
75
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
-
88
76
@ Test
89
77
void canMockBeanProducedByFactoryBeanWithClassObjectTypeAttribute () {
90
78
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext ();
You can’t perform that action at this time.
0 commit comments