2626import java .security .PrivilegedAction ;
2727import java .text .NumberFormat ;
2828import java .text .ParseException ;
29- import java .util .Arrays ;
3029import java .util .HashSet ;
3130import java .util .Iterator ;
3231import java .util .List ;
9594import static org .assertj .core .api .Assertions .assertThatExceptionOfType ;
9695import static org .assertj .core .api .Assertions .assertThatIllegalArgumentException ;
9796import static org .assertj .core .api .Assertions .assertThatIllegalStateException ;
97+ import static org .assertj .core .api .Assertions .assertThatNoException ;
9898import static org .mockito .ArgumentMatchers .any ;
9999import static org .mockito .ArgumentMatchers .eq ;
100100import static org .mockito .ArgumentMatchers .isNull ;
@@ -178,10 +178,8 @@ void prototypeFactoryBeanIgnoredByNonEagerTypeMatching() {
178178 registerBeanDefinitions (p );
179179
180180 assertThat (!DummyFactory .wasPrototypeCreated ()).as ("prototype not instantiated" ).isTrue ();
181- String [] beanNames = lbf .getBeanNamesForType (TestBean .class , true , false );
182- assertThat (beanNames ).hasSize (0 );
183- beanNames = lbf .getBeanNamesForAnnotation (SuppressWarnings .class );
184- assertThat (beanNames ).hasSize (0 );
181+ assertBeanNamesForType (TestBean .class , false , false );
182+ assertThat (lbf .getBeanNamesForAnnotation (SuppressWarnings .class )).isEmpty ();
185183
186184 assertThat (lbf .containsSingleton ("x1" )).isFalse ();
187185 assertThat (lbf .containsBean ("x1" )).isTrue ();
@@ -212,10 +210,8 @@ void singletonFactoryBeanIgnoredByNonEagerTypeMatching() {
212210 registerBeanDefinitions (p );
213211
214212 assertThat (!DummyFactory .wasPrototypeCreated ()).as ("prototype not instantiated" ).isTrue ();
215- String [] beanNames = lbf .getBeanNamesForType (TestBean .class , true , false );
216- assertThat (beanNames ).hasSize (0 );
217- beanNames = lbf .getBeanNamesForAnnotation (SuppressWarnings .class );
218- assertThat (beanNames ).hasSize (0 );
213+ assertBeanNamesForType (TestBean .class , false , false );
214+ assertThat (lbf .getBeanNamesForAnnotation (SuppressWarnings .class )).isEmpty ();
219215
220216 assertThat (lbf .containsSingleton ("x1" )).isFalse ();
221217 assertThat (lbf .containsBean ("x1" )).isTrue ();
@@ -245,10 +241,8 @@ void nonInitializedFactoryBeanIgnoredByNonEagerTypeMatching() {
245241 registerBeanDefinitions (p );
246242
247243 assertThat (!DummyFactory .wasPrototypeCreated ()).as ("prototype not instantiated" ).isTrue ();
248- String [] beanNames = lbf .getBeanNamesForType (TestBean .class , true , false );
249- assertThat (beanNames ).hasSize (0 );
250- beanNames = lbf .getBeanNamesForAnnotation (SuppressWarnings .class );
251- assertThat (beanNames ).hasSize (0 );
244+ assertBeanNamesForType (TestBean .class , false , false );
245+ assertThat (lbf .getBeanNamesForAnnotation (SuppressWarnings .class )).isEmpty ();
252246
253247 assertThat (lbf .containsSingleton ("x1" )).isFalse ();
254248 assertThat (lbf .containsBean ("x1" )).isTrue ();
@@ -278,10 +272,8 @@ void initializedFactoryBeanFoundByNonEagerTypeMatching() {
278272 registerBeanDefinitions (p );
279273 lbf .preInstantiateSingletons ();
280274
281- assertThat (!DummyFactory .wasPrototypeCreated ()).as ("prototype not instantiated" ).isTrue ();
282- String [] beanNames = lbf .getBeanNamesForType (TestBean .class , true , false );
283- assertThat (beanNames ).hasSize (1 );
284- assertThat (beanNames [0 ]).isEqualTo ("x1" );
275+ assertThat (DummyFactory .wasPrototypeCreated ()).as ("prototype not instantiated" ).isFalse ();
276+ assertBeanNamesForType (TestBean .class , true , false , "x1" );
285277 assertThat (lbf .containsSingleton ("x1" )).isTrue ();
286278 assertThat (lbf .containsBean ("x1" )).isTrue ();
287279 assertThat (lbf .containsBean ("&x1" )).isTrue ();
@@ -316,14 +308,10 @@ void initializedFactoryBeanFoundByNonEagerTypeMatching() {
316308 assertThat (lbf .isTypeMatch ("&x2" , Object .class )).isTrue ();
317309 assertThat (lbf .getType ("x2" )).isEqualTo (TestBean .class );
318310 assertThat (lbf .getType ("&x2" )).isEqualTo (DummyFactory .class );
319- assertThat (lbf .getAliases ("x1" ).length ).isEqualTo (1 );
320- assertThat (lbf .getAliases ("x1" )[0 ]).isEqualTo ("x2" );
321- assertThat (lbf .getAliases ("&x1" ).length ).isEqualTo (1 );
322- assertThat (lbf .getAliases ("&x1" )[0 ]).isEqualTo ("&x2" );
323- assertThat (lbf .getAliases ("x2" ).length ).isEqualTo (1 );
324- assertThat (lbf .getAliases ("x2" )[0 ]).isEqualTo ("x1" );
325- assertThat (lbf .getAliases ("&x2" ).length ).isEqualTo (1 );
326- assertThat (lbf .getAliases ("&x2" )[0 ]).isEqualTo ("&x1" );
311+ assertThat (lbf .getAliases ("x1" )).containsExactly ("x2" );
312+ assertThat (lbf .getAliases ("&x1" )).containsExactly ("&x2" );
313+ assertThat (lbf .getAliases ("x2" )).containsExactly ("x1" );
314+ assertThat (lbf .getAliases ("&x2" )).containsExactly ("&x1" );
327315 }
328316
329317 @ Test
@@ -333,9 +321,7 @@ void staticFactoryMethodFoundByNonEagerTypeMatching() {
333321 lbf .registerBeanDefinition ("x1" , rbd );
334322
335323 TestBeanFactory .initialized = false ;
336- String [] beanNames = lbf .getBeanNamesForType (TestBean .class , true , false );
337- assertThat (beanNames ).hasSize (1 );
338- assertThat (beanNames [0 ]).isEqualTo ("x1" );
324+ assertBeanNamesForType (TestBean .class , true , false , "x1" );
339325 assertThat (lbf .containsSingleton ("x1" )).isFalse ();
340326 assertThat (lbf .containsBean ("x1" )).isTrue ();
341327 assertThat (lbf .containsBean ("&x1" )).isFalse ();
@@ -358,9 +344,7 @@ void staticPrototypeFactoryMethodFoundByNonEagerTypeMatching() {
358344 lbf .registerBeanDefinition ("x1" , rbd );
359345
360346 TestBeanFactory .initialized = false ;
361- String [] beanNames = lbf .getBeanNamesForType (TestBean .class , true , false );
362- assertThat (beanNames ).hasSize (1 );
363- assertThat (beanNames [0 ]).isEqualTo ("x1" );
347+ assertBeanNamesForType (TestBean .class , true , false , "x1" );
364348 assertThat (lbf .containsSingleton ("x1" )).isFalse ();
365349 assertThat (lbf .containsBean ("x1" )).isTrue ();
366350 assertThat (lbf .containsBean ("&x1" )).isFalse ();
@@ -385,9 +369,7 @@ void nonStaticFactoryMethodFoundByNonEagerTypeMatching() {
385369 lbf .registerBeanDefinition ("x1" , rbd );
386370
387371 TestBeanFactory .initialized = false ;
388- String [] beanNames = lbf .getBeanNamesForType (TestBean .class , true , false );
389- assertThat (beanNames ).hasSize (1 );
390- assertThat (beanNames [0 ]).isEqualTo ("x1" );
372+ assertBeanNamesForType (TestBean .class , true , false , "x1" );
391373 assertThat (lbf .containsSingleton ("x1" )).isFalse ();
392374 assertThat (lbf .containsBean ("x1" )).isTrue ();
393375 assertThat (lbf .containsBean ("&x1" )).isFalse ();
@@ -413,9 +395,7 @@ void nonStaticPrototypeFactoryMethodFoundByNonEagerTypeMatching() {
413395 lbf .registerBeanDefinition ("x1" , rbd );
414396
415397 TestBeanFactory .initialized = false ;
416- String [] beanNames = lbf .getBeanNamesForType (TestBean .class , true , false );
417- assertThat (beanNames ).hasSize (1 );
418- assertThat (beanNames [0 ]).isEqualTo ("x1" );
398+ assertBeanNamesForType (TestBean .class , true , false , "x1" );
419399 assertThat (lbf .containsSingleton ("x1" )).isFalse ();
420400 assertThat (lbf .containsBean ("x1" )).isTrue ();
421401 assertThat (lbf .containsBean ("&x1" )).isFalse ();
@@ -448,14 +428,10 @@ void nonStaticPrototypeFactoryMethodFoundByNonEagerTypeMatching() {
448428 assertThat (lbf .isTypeMatch ("&x2" , Object .class )).isFalse ();
449429 assertThat (lbf .getType ("x2" )).isEqualTo (TestBean .class );
450430 assertThat (lbf .getType ("&x2" )).isNull ();
451- assertThat (lbf .getAliases ("x1" ).length ).isEqualTo (1 );
452- assertThat (lbf .getAliases ("x1" )[0 ]).isEqualTo ("x2" );
453- assertThat (lbf .getAliases ("&x1" ).length ).isEqualTo (1 );
454- assertThat (lbf .getAliases ("&x1" )[0 ]).isEqualTo ("&x2" );
455- assertThat (lbf .getAliases ("x2" ).length ).isEqualTo (1 );
456- assertThat (lbf .getAliases ("x2" )[0 ]).isEqualTo ("x1" );
457- assertThat (lbf .getAliases ("&x2" ).length ).isEqualTo (1 );
458- assertThat (lbf .getAliases ("&x2" )[0 ]).isEqualTo ("&x1" );
431+ assertThat (lbf .getAliases ("x1" )).containsExactly ("x2" );
432+ assertThat (lbf .getAliases ("&x1" )).containsExactly ("&x2" );
433+ assertThat (lbf .getAliases ("x2" )).containsExactly ("x1" );
434+ assertThat (lbf .getAliases ("&x2" )).containsExactly ("&x1" );
459435 }
460436
461437 @ Test
@@ -619,8 +595,7 @@ void arrayReferenceByName() {
619595 lbf .registerSingleton ("string" , "A" );
620596
621597 TestBean self = (TestBean ) lbf .getBean ("self" );
622- assertThat (self .getStringArray ()).hasSize (1 );
623- assertThat (self .getStringArray ()).contains ("A" );
598+ assertThat (self .getStringArray ()).containsExactly ("A" );
624599 }
625600
626601 @ Test
@@ -633,8 +608,7 @@ void arrayReferenceByType() {
633608 lbf .registerSingleton ("string" , "A" );
634609
635610 TestBean self = (TestBean ) lbf .getBean ("self" );
636- assertThat (self .getStringArray ()).hasSize (1 );
637- assertThat (self .getStringArray ()).contains ("A" );
611+ assertThat (self .getStringArray ()).containsExactly ("A" );
638612 }
639613
640614 @ Test
@@ -666,8 +640,7 @@ void possibleMatches() {
666640 .withCauseInstanceOf (NotWritablePropertyException .class )
667641 .satisfies (ex -> {
668642 NotWritablePropertyException cause = (NotWritablePropertyException ) ex .getCause ();
669- assertThat (cause .getPossibleMatches ()).hasSize (1 );
670- assertThat (cause .getPossibleMatches ()[0 ]).isEqualTo ("age" );
643+ assertThat (cause .getPossibleMatches ()).containsExactly ("age" );
671644 });
672645 }
673646
@@ -685,7 +658,7 @@ void prototype() {
685658 lbf = new DefaultListableBeanFactory ();
686659 p = new Properties ();
687660 p .setProperty ("kerry.(class)" , TestBean .class .getName ());
688- p .setProperty ("kerry.(scope)" , "prototype" );
661+ p .setProperty ("kerry.(scope)" , BeanDefinition . SCOPE_PROTOTYPE );
689662 p .setProperty ("kerry.age" , "35" );
690663 registerBeanDefinitions (p );
691664 kerry1 = (TestBean ) lbf .getBean ("kerry" );
@@ -1145,7 +1118,7 @@ void registerExistingSingletonWithAutowire() {
11451118 assertThat (lbf .containsBean ("singletonObject" )).isTrue ();
11461119 assertThat (lbf .isSingleton ("singletonObject" )).isTrue ();
11471120 assertThat (lbf .getType ("singletonObject" )).isEqualTo (TestBean .class );
1148- assertThat (lbf .getAliases ("singletonObject" ). length ). isEqualTo ( 0 );
1121+ assertThat (lbf .getAliases ("singletonObject" )). isEmpty ( );
11491122 DependenciesBean test = (DependenciesBean ) lbf .getBean ("test" );
11501123 assertThat (lbf .getBean ("singletonObject" )).isEqualTo (singletonObject );
11511124 assertThat (test .getSpouse ()).isEqualTo (singletonObject );
@@ -1791,12 +1764,12 @@ void getBeanWithArgsNotCreatedForFactoryBeanChecking() {
17911764 assertThat (bean .beanName ).isEqualTo ("bd1" );
17921765 assertThat (bean .spouseAge ).isEqualTo (42 );
17931766
1794- assertThat (lbf .getBeanNamesForType (ConstructorDependency .class ). length ). isEqualTo (1 );
1795- assertThat (lbf .getBeanNamesForType (ConstructorDependencyFactoryBean .class ). length ). isEqualTo (1 );
1796- assertThat (lbf .getBeanNamesForType (ResolvableType .forClassWithGenerics (FactoryBean .class , Object .class )). length ). isEqualTo (1 );
1797- assertThat (lbf .getBeanNamesForType (ResolvableType .forClassWithGenerics (FactoryBean .class , String .class )). length ). isEqualTo ( 0 );
1798- assertThat (lbf .getBeanNamesForType (ResolvableType .forClassWithGenerics (FactoryBean .class , Object .class ), true , true ). length ). isEqualTo (1 );
1799- assertThat (lbf .getBeanNamesForType (ResolvableType .forClassWithGenerics (FactoryBean .class , String .class ), true , true ). length ). isEqualTo ( 0 );
1767+ assertThat (lbf .getBeanNamesForType (ConstructorDependency .class )). hasSize (1 );
1768+ assertThat (lbf .getBeanNamesForType (ConstructorDependencyFactoryBean .class )). hasSize (1 );
1769+ assertThat (lbf .getBeanNamesForType (ResolvableType .forClassWithGenerics (FactoryBean .class , Object .class ))). hasSize (1 );
1770+ assertThat (lbf .getBeanNamesForType (ResolvableType .forClassWithGenerics (FactoryBean .class , String .class ))). isEmpty ( );
1771+ assertThat (lbf .getBeanNamesForType (ResolvableType .forClassWithGenerics (FactoryBean .class , Object .class ), true , true )). hasSize (1 );
1772+ assertThat (lbf .getBeanNamesForType (ResolvableType .forClassWithGenerics (FactoryBean .class , String .class ), true , true )). isEmpty ( );
18001773 }
18011774
18021775 private RootBeanDefinition createConstructorDependencyBeanDefinition (int age ) {
@@ -1861,46 +1834,29 @@ void getTypeForAbstractFactoryBean() {
18611834
18621835 @ Test
18631836 void getBeanNamesForTypeBeforeFactoryBeanCreation () {
1837+ FactoryBeanThatShouldntBeCalled .instantiated = false ;
18641838 lbf .registerBeanDefinition ("factoryBean" , new RootBeanDefinition (FactoryBeanThatShouldntBeCalled .class ));
18651839 assertThat (lbf .containsSingleton ("factoryBean" )).isFalse ();
1840+ assertThat (FactoryBeanThatShouldntBeCalled .instantiated ).isFalse ();
18661841
1867- String [] beanNames = lbf .getBeanNamesForType (Runnable .class , false , false );
1868- assertThat (beanNames .length ).isEqualTo (1 );
1869- assertThat (beanNames [0 ]).isEqualTo ("&factoryBean" );
1870-
1871- beanNames = lbf .getBeanNamesForType (Callable .class , false , false );
1872- assertThat (beanNames .length ).isEqualTo (1 );
1873- assertThat (beanNames [0 ]).isEqualTo ("&factoryBean" );
1874-
1875- beanNames = lbf .getBeanNamesForType (RepositoryFactoryInformation .class , false , false );
1876- assertThat (beanNames .length ).isEqualTo (1 );
1877- assertThat (beanNames [0 ]).isEqualTo ("&factoryBean" );
1878-
1879- beanNames = lbf .getBeanNamesForType (FactoryBean .class , false , false );
1880- assertThat (beanNames .length ).isEqualTo (1 );
1881- assertThat (beanNames [0 ]).isEqualTo ("&factoryBean" );
1842+ assertBeanNamesForType (Runnable .class , false , false , "&factoryBean" );
1843+ assertBeanNamesForType (Callable .class , false , false , "&factoryBean" );
1844+ assertBeanNamesForType (RepositoryFactoryInformation .class , false , false , "&factoryBean" );
1845+ assertBeanNamesForType (FactoryBean .class , false , false , "&factoryBean" );
18821846 }
18831847
18841848 @ Test
18851849 void getBeanNamesForTypeAfterFactoryBeanCreation () {
1850+ FactoryBeanThatShouldntBeCalled .instantiated = false ;
18861851 lbf .registerBeanDefinition ("factoryBean" , new RootBeanDefinition (FactoryBeanThatShouldntBeCalled .class ));
18871852 lbf .getBean ("&factoryBean" );
1853+ assertThat (FactoryBeanThatShouldntBeCalled .instantiated ).isTrue ();
1854+ assertThat (lbf .containsSingleton ("factoryBean" )).isTrue ();
18881855
1889- String [] beanNames = lbf .getBeanNamesForType (Runnable .class , false , false );
1890- assertThat (beanNames .length ).isEqualTo (1 );
1891- assertThat (beanNames [0 ]).isEqualTo ("&factoryBean" );
1892-
1893- beanNames = lbf .getBeanNamesForType (Callable .class , false , false );
1894- assertThat (beanNames .length ).isEqualTo (1 );
1895- assertThat (beanNames [0 ]).isEqualTo ("&factoryBean" );
1896-
1897- beanNames = lbf .getBeanNamesForType (RepositoryFactoryInformation .class , false , false );
1898- assertThat (beanNames .length ).isEqualTo (1 );
1899- assertThat (beanNames [0 ]).isEqualTo ("&factoryBean" );
1900-
1901- beanNames = lbf .getBeanNamesForType (FactoryBean .class , false , false );
1902- assertThat (beanNames .length ).isEqualTo (1 );
1903- assertThat (beanNames [0 ]).isEqualTo ("&factoryBean" );
1856+ assertBeanNamesForType (Runnable .class , false , false , "&factoryBean" );
1857+ assertBeanNamesForType (Callable .class , false , false , "&factoryBean" );
1858+ assertBeanNamesForType (RepositoryFactoryInformation .class , false , false , "&factoryBean" );
1859+ assertBeanNamesForType (FactoryBean .class , false , false , "&factoryBean" );
19041860 }
19051861
19061862 /**
@@ -2165,26 +2121,23 @@ void circularReferenceThroughAutowiring() {
21652121 RootBeanDefinition bd = new RootBeanDefinition (ConstructorDependencyBean .class );
21662122 bd .setAutowireMode (RootBeanDefinition .AUTOWIRE_CONSTRUCTOR );
21672123 lbf .registerBeanDefinition ("test" , bd );
2168- assertThatExceptionOfType (UnsatisfiedDependencyException .class ).isThrownBy (
2169- lbf ::preInstantiateSingletons );
2124+ assertThatExceptionOfType (UnsatisfiedDependencyException .class ).isThrownBy (lbf ::preInstantiateSingletons );
21702125 }
21712126
21722127 @ Test
21732128 void circularReferenceThroughFactoryBeanAutowiring () {
21742129 RootBeanDefinition bd = new RootBeanDefinition (ConstructorDependencyFactoryBean .class );
21752130 bd .setAutowireMode (RootBeanDefinition .AUTOWIRE_CONSTRUCTOR );
21762131 lbf .registerBeanDefinition ("test" , bd );
2177- assertThatExceptionOfType (UnsatisfiedDependencyException .class ).isThrownBy (
2178- lbf ::preInstantiateSingletons );
2132+ assertThatExceptionOfType (UnsatisfiedDependencyException .class ).isThrownBy (lbf ::preInstantiateSingletons );
21792133 }
21802134
21812135 @ Test
21822136 void circularReferenceThroughFactoryBeanTypeCheck () {
21832137 RootBeanDefinition bd = new RootBeanDefinition (ConstructorDependencyFactoryBean .class );
21842138 bd .setAutowireMode (RootBeanDefinition .AUTOWIRE_CONSTRUCTOR );
21852139 lbf .registerBeanDefinition ("test" , bd );
2186- assertThatExceptionOfType (UnsatisfiedDependencyException .class ).isThrownBy (() ->
2187- lbf .getBeansOfType (String .class ));
2140+ assertThatExceptionOfType (UnsatisfiedDependencyException .class ).isThrownBy (() -> lbf .getBeansOfType (String .class ));
21882141 }
21892142
21902143 @ Test
@@ -2211,8 +2164,7 @@ void constructorDependencyWithUnresolvableClass() {
22112164 RootBeanDefinition bd = new RootBeanDefinition (ConstructorDependencyWithClassResolution .class );
22122165 bd .getConstructorArgumentValues ().addGenericArgumentValue ("java.lang.Strin" );
22132166 lbf .registerBeanDefinition ("test" , bd );
2214- assertThatExceptionOfType (UnsatisfiedDependencyException .class ).isThrownBy (
2215- lbf ::preInstantiateSingletons );
2167+ assertThatExceptionOfType (UnsatisfiedDependencyException .class ).isThrownBy (lbf ::preInstantiateSingletons );
22162168 }
22172169
22182170 @ Test
@@ -2236,7 +2188,13 @@ void beanDefinitionWithAbstractClass() {
22362188 @ Test
22372189 void prototypeFactoryBeanNotEagerlyCalled () {
22382190 lbf .registerBeanDefinition ("test" , new RootBeanDefinition (FactoryBeanThatShouldntBeCalled .class ));
2239- lbf .preInstantiateSingletons ();
2191+ assertThatNoException ().isThrownBy (lbf ::preInstantiateSingletons );
2192+ }
2193+
2194+ @ Test
2195+ void prototypeFactoryBeanNotEagerlyCalledInCaseOfBeanClassName () {
2196+ lbf .registerBeanDefinition ("test" , new RootBeanDefinition (FactoryBeanThatShouldntBeCalled .class .getName (), null , null ));
2197+ assertThatNoException ().isThrownBy (lbf ::preInstantiateSingletons );
22402198 }
22412199
22422200 @ Test
@@ -2276,13 +2234,6 @@ void smartInitFactory() {
22762234 assertThat (factory .initialized ).isTrue ();
22772235 }
22782236
2279- @ Test
2280- void prototypeFactoryBeanNotEagerlyCalledInCaseOfBeanClassName () {
2281- lbf .registerBeanDefinition ("test" ,
2282- new RootBeanDefinition (FactoryBeanThatShouldntBeCalled .class .getName (), null , null ));
2283- lbf .preInstantiateSingletons ();
2284- }
2285-
22862237 @ Test
22872238 void prototypeStringCreatedRepeatedly () {
22882239 RootBeanDefinition stringDef = new RootBeanDefinition (String .class );
@@ -2462,10 +2413,7 @@ private void findTypeOfPrototypeFactoryMethodOnBeanInstance(boolean singleton) {
24622413 lbf .registerBeanDefinition ("fmWithArgs" , factoryMethodDefinitionWithArgs );
24632414
24642415 assertThat (lbf .getBeanDefinitionCount ()).isEqualTo (4 );
2465- List <String > tbNames = Arrays .asList (lbf .getBeanNamesForType (TestBean .class ));
2466- assertThat (tbNames .contains ("fmWithProperties" )).isTrue ();
2467- assertThat (tbNames .contains ("fmWithArgs" )).isTrue ();
2468- assertThat (tbNames .size ()).isEqualTo (2 );
2416+ assertBeanNamesForType (TestBean .class , true , true , "fmWithProperties" , "fmWithArgs" );
24692417
24702418 TestBean tb = (TestBean ) lbf .getBean ("fmWithProperties" );
24712419 TestBean second = (TestBean ) lbf .getBean ("fmWithProperties" );
@@ -2669,6 +2617,19 @@ private int registerBeanDefinitions(Properties p, String prefix) {
26692617 return (new org .springframework .beans .factory .support .PropertiesBeanDefinitionReader (lbf )).registerBeanDefinitions (p , prefix );
26702618 }
26712619
2620+ private void assertBeanNamesForType (Class <?> type , boolean includeNonSingletons , boolean allowEagerInit , String ... names ) {
2621+ if (names .length == 0 ) {
2622+ assertThat (lbf .getBeanNamesForType (type , includeNonSingletons , allowEagerInit ))
2623+ .as ("bean names for type " + type .getName ())
2624+ .isEmpty ();
2625+ }
2626+ else {
2627+ assertThat (lbf .getBeanNamesForType (type , includeNonSingletons , allowEagerInit ))
2628+ .as ("bean names for type " + type .getName ())
2629+ .containsExactly (names );
2630+ }
2631+ }
2632+
26722633
26732634 public static class NoDependencies {
26742635
@@ -2859,6 +2820,12 @@ public static abstract class RepositoryFactoryBeanSupport<T extends Repository<S
28592820 public static class FactoryBeanThatShouldntBeCalled <T extends Repository <S , ID >, S , ID extends Serializable >
28602821 extends RepositoryFactoryBeanSupport <T , S , ID > implements Runnable , Callable <T > {
28612822
2823+ static boolean instantiated = false ;
2824+
2825+ {
2826+ instantiated = true ;
2827+ }
2828+
28622829 @ Override
28632830 public T getObject () {
28642831 throw new IllegalStateException ();
0 commit comments