1
1
/*
2
- * Copyright 2002-2018 the original author or authors.
2
+ * Copyright 2002-2019 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -123,16 +123,16 @@ private static ClassPathResource classPathResource(String suffix) {
123
123
return new ClassPathResource (CLASSNAME + suffix , CLASS );
124
124
}
125
125
126
- /* SPR-2368 */
127
- @ Test
128
- public void testCollectionsReferredToAsRefLocals () throws Exception {
126
+
127
+ @ Test // SPR-2368
128
+ public void testCollectionsReferredToAsRefLocals () {
129
129
DefaultListableBeanFactory factory = new DefaultListableBeanFactory ();
130
130
new XmlBeanDefinitionReader (factory ).loadBeanDefinitions (COLLECTIONS_XSD_CONTEXT );
131
131
factory .preInstantiateSingletons ();
132
132
}
133
133
134
134
@ Test
135
- public void testRefToSeparatePrototypeInstances () throws Exception {
135
+ public void testRefToSeparatePrototypeInstances () {
136
136
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory ();
137
137
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader (xbf );
138
138
reader .setValidationMode (XmlBeanDefinitionReader .VALIDATION_NONE );
@@ -151,7 +151,7 @@ public void testRefToSeparatePrototypeInstances() throws Exception {
151
151
}
152
152
153
153
@ Test
154
- public void testRefToSingleton () throws Exception {
154
+ public void testRefToSingleton () {
155
155
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory ();
156
156
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader (xbf );
157
157
reader .setValidationMode (XmlBeanDefinitionReader .VALIDATION_NONE );
@@ -307,7 +307,7 @@ public void testFailsOnInnerBean() {
307
307
}
308
308
309
309
@ Test
310
- public void testInheritanceFromParentFactoryPrototype () throws Exception {
310
+ public void testInheritanceFromParentFactoryPrototype () {
311
311
DefaultListableBeanFactory parent = new DefaultListableBeanFactory ();
312
312
new XmlBeanDefinitionReader (parent ).loadBeanDefinitions (PARENT_CONTEXT );
313
313
DefaultListableBeanFactory child = new DefaultListableBeanFactory (parent );
@@ -323,7 +323,7 @@ public void testInheritanceFromParentFactoryPrototype() throws Exception {
323
323
}
324
324
325
325
@ Test
326
- public void testInheritanceWithDifferentClass () throws Exception {
326
+ public void testInheritanceWithDifferentClass () {
327
327
DefaultListableBeanFactory parent = new DefaultListableBeanFactory ();
328
328
new XmlBeanDefinitionReader (parent ).loadBeanDefinitions (PARENT_CONTEXT );
329
329
DefaultListableBeanFactory child = new DefaultListableBeanFactory (parent );
@@ -338,7 +338,7 @@ public void testInheritanceWithDifferentClass() throws Exception {
338
338
}
339
339
340
340
@ Test
341
- public void testInheritanceWithClass () throws Exception {
341
+ public void testInheritanceWithClass () {
342
342
DefaultListableBeanFactory parent = new DefaultListableBeanFactory ();
343
343
new XmlBeanDefinitionReader (parent ).loadBeanDefinitions (PARENT_CONTEXT );
344
344
DefaultListableBeanFactory child = new DefaultListableBeanFactory (parent );
@@ -353,7 +353,7 @@ public void testInheritanceWithClass() throws Exception {
353
353
}
354
354
355
355
@ Test
356
- public void testPrototypeInheritanceFromParentFactoryPrototype () throws Exception {
356
+ public void testPrototypeInheritanceFromParentFactoryPrototype () {
357
357
DefaultListableBeanFactory parent = new DefaultListableBeanFactory ();
358
358
new XmlBeanDefinitionReader (parent ).loadBeanDefinitions (PARENT_CONTEXT );
359
359
DefaultListableBeanFactory child = new DefaultListableBeanFactory (parent );
@@ -373,7 +373,7 @@ public void testPrototypeInheritanceFromParentFactoryPrototype() throws Exceptio
373
373
}
374
374
375
375
@ Test
376
- public void testPrototypeInheritanceFromParentFactorySingleton () throws Exception {
376
+ public void testPrototypeInheritanceFromParentFactorySingleton () {
377
377
DefaultListableBeanFactory parent = new DefaultListableBeanFactory ();
378
378
new XmlBeanDefinitionReader (parent ).loadBeanDefinitions (PARENT_CONTEXT );
379
379
DefaultListableBeanFactory child = new DefaultListableBeanFactory (parent );
@@ -433,7 +433,7 @@ public void testAbstractParentBeans() {
433
433
}
434
434
435
435
@ Test
436
- public void testDependenciesMaterializeThis () throws Exception {
436
+ public void testDependenciesMaterializeThis () {
437
437
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory ();
438
438
new XmlBeanDefinitionReader (xbf ).loadBeanDefinitions (DEP_MATERIALIZE_CONTEXT );
439
439
@@ -452,7 +452,7 @@ public void testDependenciesMaterializeThis() throws Exception {
452
452
}
453
453
454
454
@ Test
455
- public void testChildOverridesParentBean () throws Exception {
455
+ public void testChildOverridesParentBean () {
456
456
DefaultListableBeanFactory parent = new DefaultListableBeanFactory ();
457
457
new XmlBeanDefinitionReader (parent ).loadBeanDefinitions (PARENT_CONTEXT );
458
458
DefaultListableBeanFactory child = new DefaultListableBeanFactory (parent );
@@ -471,7 +471,7 @@ public void testChildOverridesParentBean() throws Exception {
471
471
* If a singleton does this the factory will fail to load.
472
472
*/
473
473
@ Test
474
- public void testBogusParentageFromParentFactory () throws Exception {
474
+ public void testBogusParentageFromParentFactory () {
475
475
DefaultListableBeanFactory parent = new DefaultListableBeanFactory ();
476
476
new XmlBeanDefinitionReader (parent ).loadBeanDefinitions (PARENT_CONTEXT );
477
477
DefaultListableBeanFactory child = new DefaultListableBeanFactory (parent );
@@ -493,7 +493,7 @@ public void testBogusParentageFromParentFactory() throws Exception {
493
493
* instances even if derived from a prototype
494
494
*/
495
495
@ Test
496
- public void testSingletonInheritsFromParentFactoryPrototype () throws Exception {
496
+ public void testSingletonInheritsFromParentFactoryPrototype () {
497
497
DefaultListableBeanFactory parent = new DefaultListableBeanFactory ();
498
498
new XmlBeanDefinitionReader (parent ).loadBeanDefinitions (PARENT_CONTEXT );
499
499
DefaultListableBeanFactory child = new DefaultListableBeanFactory (parent );
@@ -658,7 +658,7 @@ public void noSuchFactoryBeanMethod() {
658
658
}
659
659
660
660
@ Test
661
- public void testInitMethodIsInvoked () throws Exception {
661
+ public void testInitMethodIsInvoked () {
662
662
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory ();
663
663
new XmlBeanDefinitionReader (xbf ).loadBeanDefinitions (INITIALIZERS_CONTEXT );
664
664
DoubleInitializer in = (DoubleInitializer ) xbf .getBean ("init-method1" );
@@ -685,7 +685,7 @@ public void testInitMethodThrowsException() {
685
685
}
686
686
687
687
@ Test
688
- public void testNoSuchInitMethod () throws Exception {
688
+ public void testNoSuchInitMethod () {
689
689
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory ();
690
690
new XmlBeanDefinitionReader (xbf ).loadBeanDefinitions (INITIALIZERS_CONTEXT );
691
691
try {
@@ -704,7 +704,7 @@ public void testNoSuchInitMethod() throws Exception {
704
704
* Check that InitializingBean method is called first.
705
705
*/
706
706
@ Test
707
- public void testInitializingBeanAndInitMethod () throws Exception {
707
+ public void testInitializingBeanAndInitMethod () {
708
708
InitAndIB .constructed = false ;
709
709
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory ();
710
710
new XmlBeanDefinitionReader (xbf ).loadBeanDefinitions (INITIALIZERS_CONTEXT );
@@ -725,7 +725,7 @@ public void testInitializingBeanAndInitMethod() throws Exception {
725
725
* Check that InitializingBean method is not called twice.
726
726
*/
727
727
@ Test
728
- public void testInitializingBeanAndSameInitMethod () throws Exception {
728
+ public void testInitializingBeanAndSameInitMethod () {
729
729
InitAndIB .constructed = false ;
730
730
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory ();
731
731
new XmlBeanDefinitionReader (xbf ).loadBeanDefinitions (INITIALIZERS_CONTEXT );
@@ -743,7 +743,7 @@ public void testInitializingBeanAndSameInitMethod() throws Exception {
743
743
}
744
744
745
745
@ Test
746
- public void testDefaultLazyInit () throws Exception {
746
+ public void testDefaultLazyInit () {
747
747
InitAndIB .constructed = false ;
748
748
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory ();
749
749
new XmlBeanDefinitionReader (xbf ).loadBeanDefinitions (DEFAULT_LAZY_CONTEXT );
@@ -759,19 +759,19 @@ public void testDefaultLazyInit() throws Exception {
759
759
}
760
760
761
761
@ Test (expected = BeanDefinitionStoreException .class )
762
- public void noSuchXmlFile () throws Exception {
762
+ public void noSuchXmlFile () {
763
763
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory ();
764
764
new XmlBeanDefinitionReader (xbf ).loadBeanDefinitions (MISSING_CONTEXT );
765
765
}
766
766
767
767
@ Test (expected = BeanDefinitionStoreException .class )
768
- public void invalidXmlFile () throws Exception {
768
+ public void invalidXmlFile () {
769
769
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory ();
770
770
new XmlBeanDefinitionReader (xbf ).loadBeanDefinitions (INVALID_CONTEXT );
771
771
}
772
772
773
773
@ Test
774
- public void testAutowire () throws Exception {
774
+ public void testAutowire () {
775
775
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory ();
776
776
new XmlBeanDefinitionReader (xbf ).loadBeanDefinitions (AUTOWIRE_CONTEXT );
777
777
TestBean spouse = new TestBean ("kerry" , 0 );
@@ -780,7 +780,7 @@ public void testAutowire() throws Exception {
780
780
}
781
781
782
782
@ Test
783
- public void testAutowireWithParent () throws Exception {
783
+ public void testAutowireWithParent () {
784
784
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory ();
785
785
new XmlBeanDefinitionReader (xbf ).loadBeanDefinitions (AUTOWIRE_CONTEXT );
786
786
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory ();
@@ -793,7 +793,7 @@ public void testAutowireWithParent() throws Exception {
793
793
doTestAutowire (xbf );
794
794
}
795
795
796
- private void doTestAutowire (DefaultListableBeanFactory xbf ) throws Exception {
796
+ private void doTestAutowire (DefaultListableBeanFactory xbf ) {
797
797
DependenciesBean rod1 = (DependenciesBean ) xbf .getBean ("rod1" );
798
798
TestBean kerry = (TestBean ) xbf .getBean ("spouse" );
799
799
// should have been autowired
@@ -842,7 +842,7 @@ private void doTestAutowire(DefaultListableBeanFactory xbf) throws Exception {
842
842
}
843
843
844
844
@ Test
845
- public void testAutowireWithDefault () throws Exception {
845
+ public void testAutowireWithDefault () {
846
846
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory ();
847
847
new XmlBeanDefinitionReader (xbf ).loadBeanDefinitions (DEFAULT_AUTOWIRE_CONTEXT );
848
848
@@ -858,7 +858,7 @@ public void testAutowireWithDefault() throws Exception {
858
858
}
859
859
860
860
@ Test
861
- public void testAutowireByConstructor () throws Exception {
861
+ public void testAutowireByConstructor () {
862
862
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory ();
863
863
new XmlBeanDefinitionReader (xbf ).loadBeanDefinitions (CONSTRUCTOR_ARG_CONTEXT );
864
864
ConstructorDependenciesBean rod1 = (ConstructorDependenciesBean ) xbf .getBean ("rod1" );
@@ -896,7 +896,7 @@ public void testAutowireByConstructor() throws Exception {
896
896
}
897
897
898
898
@ Test
899
- public void testAutowireByConstructorWithSimpleValues () throws Exception {
899
+ public void testAutowireByConstructorWithSimpleValues () {
900
900
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory ();
901
901
new XmlBeanDefinitionReader (xbf ).loadBeanDefinitions (CONSTRUCTOR_ARG_CONTEXT );
902
902
@@ -1014,14 +1014,14 @@ public void testConstructorArgWithSingleMatch() {
1014
1014
}
1015
1015
1016
1016
@ Test (expected = BeanCreationException .class )
1017
- public void throwsExceptionOnTooManyArguments () throws Exception {
1017
+ public void throwsExceptionOnTooManyArguments () {
1018
1018
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory ();
1019
1019
new XmlBeanDefinitionReader (xbf ).loadBeanDefinitions (CONSTRUCTOR_ARG_CONTEXT );
1020
1020
xbf .getBean ("rod7" , ConstructorDependenciesBean .class );
1021
1021
}
1022
1022
1023
1023
@ Test (expected = UnsatisfiedDependencyException .class )
1024
- public void throwsExceptionOnAmbiguousResolution () throws Exception {
1024
+ public void throwsExceptionOnAmbiguousResolution () {
1025
1025
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory ();
1026
1026
new XmlBeanDefinitionReader (xbf ).loadBeanDefinitions (CONSTRUCTOR_ARG_CONTEXT );
1027
1027
xbf .getBean ("rod8" , ConstructorDependenciesBean .class );
@@ -1372,7 +1372,7 @@ public void testRejectsOverrideOfBogusMethodName() {
1372
1372
}
1373
1373
1374
1374
@ Test
1375
- public void serializableMethodReplacerAndSuperclass () throws Exception {
1375
+ public void serializableMethodReplacerAndSuperclass () throws IOException {
1376
1376
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory ();
1377
1377
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader (xbf );
1378
1378
reader .loadBeanDefinitions (DELEGATION_OVERRIDES_CONTEXT );
@@ -1571,7 +1571,7 @@ public void testConstructorWithUnresolvableParameterName() {
1571
1571
}
1572
1572
1573
1573
@ Test
1574
- public void testWithDuplicateName () throws Exception {
1574
+ public void testWithDuplicateName () {
1575
1575
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory ();
1576
1576
try {
1577
1577
new XmlBeanDefinitionReader (xbf ).loadBeanDefinitions (TEST_WITH_DUP_NAMES_CONTEXT );
@@ -1583,7 +1583,7 @@ public void testWithDuplicateName() throws Exception {
1583
1583
}
1584
1584
1585
1585
@ Test
1586
- public void testWithDuplicateNameInAlias () throws Exception {
1586
+ public void testWithDuplicateNameInAlias () {
1587
1587
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory ();
1588
1588
try {
1589
1589
new XmlBeanDefinitionReader (xbf ).loadBeanDefinitions (TEST_WITH_DUP_NAME_IN_ALIAS_CONTEXT );
0 commit comments