@@ -15,31 +15,17 @@ public void setUp() throws Exception {
1515 applicationContext = new ClassPathXmlApplicationContext ("com.baeldung.di.spring.xml" );
1616 }
1717
18- @ Test
19- public void protoBean_getBean_returnsMultipleInstance () {
20- final MessageApp messageApp1 = applicationContext .getBean ("messageWorldApp" , MessageApp .class );
21- final MessageApp messageApp2 = applicationContext .getBean ("messageWorldApp" , MessageApp .class );
22- assertNotEquals (messageApp1 , messageApp2 );
23- }
24-
25- @ Test
26- public void protoFactoryMethod_getBean_returnsMultipleInstance () {
27- final IndexApp indexApp1 = applicationContext .getBean ("indexAppWithFactoryMethod" , IndexApp .class );
28- final IndexApp indexApp2 = applicationContext .getBean ("indexAppWithFactoryMethod" , IndexApp .class );
29- assertNotEquals (indexApp1 , indexApp2 );
30- }
31-
32- @ Test
33- public void protoStaticFactory_getBean_returnsMultipleInstance () {
34- final IndexApp indexApp1 = applicationContext .getBean ("indexAppWithStaticFactory" , IndexApp .class );
35- final IndexApp indexApp2 = applicationContext .getBean ("indexAppWithStaticFactory" , IndexApp .class );
36- assertNotEquals (indexApp1 , indexApp2 );
37- }
38-
3918 @ Test
4019 public void singletonBean_getBean_returnsSingleInstance () {
4120 final IndexApp indexApp1 = applicationContext .getBean ("indexApp" , IndexApp .class );
4221 final IndexApp indexApp2 = applicationContext .getBean ("indexApp" , IndexApp .class );
4322 assertEquals (indexApp1 , indexApp2 );
4423 }
24+
25+ @ Test
26+ public void getBean_returnsInstance () {
27+ final IndexApp indexApp = applicationContext .getBean ("indexApp" , IndexApp .class );
28+ assertNotNull (indexApp );
29+ }
30+
4531}
0 commit comments