11/* 
2-  * Copyright 2002-2006  the original author or authors. 
2+  * Copyright 2002-2011  the original author or authors. 
33 * 
44 * Licensed under the Apache License, Version 2.0 (the "License"); 
55 * you may not use this file except in compliance with the License. 
1313 * See the License for the specific language governing permissions and 
1414 * limitations under the License. 
1515 */ 
16+ 
1617package  org .springframework .test .context .expression ;
1718
18- import  static  junit .framework .Assert .* ;
19+ import  static  junit .framework .Assert .assertEquals ;
1920
2021import  java .util .Properties ;
22+ 
2123import  org .junit .Test ;
24+ import  org .junit .runner .RunWith ;
2225import  org .springframework .beans .factory .annotation .Autowired ;
2326import  org .springframework .beans .factory .annotation .Qualifier ;
2427import  org .springframework .test .context .ContextConfiguration ;
25- import  org .springframework .test .context .junit4 .AbstractJUnit4SpringContextTests ;
28+ import  org .springframework .test .context .junit4 .SpringJUnit4ClassRunner ;
2629
2730/** 
2831 * @author Andy Clement 
2932 * @author Dave Syer 
3033 */ 
34+ @ RunWith (SpringJUnit4ClassRunner .class )
3135@ ContextConfiguration 
32- public  class  ExpressionUsageTests  extends  AbstractJUnit4SpringContextTests  {
36+ public  class  ExpressionUsageTests  {
37+ 
38+ 	@ Autowired 
39+ 	@ Qualifier ("derived" )
40+ 	private  Properties  props ;
41+ 
42+ 	@ Autowired 
43+ 	@ Qualifier ("andy2" )
44+ 	private  Foo  andy2 ;
45+ 
46+ 	@ Autowired 
47+ 	@ Qualifier ("andy" )
48+ 	private  Foo  andy ;
49+ 
3350
3451	@ Test 
3552	public  void  testSpr5906 () throws  Exception  {
36- 		Properties  props  = (Properties )applicationContext .getBean ("derived" );
37- 		
3853		// verify the property values have been evaluated as expressions 
39- 		assertEquals ("Dave" ,props .getProperty ("user.name" ));
40- 		assertEquals ("Andy" ,props .getProperty ("username" ));
41- 		 
54+ 		assertEquals ("Dave" ,  props .getProperty ("user.name" ));
55+ 		assertEquals ("Andy" ,  props .getProperty ("username" ));
56+ 
4257		// verify the property keys have been evaluated as expressions 
43- 		assertEquals ("exists" ,props .getProperty ("Dave" ));
44- 		assertEquals ("exists also" ,props .getProperty ("Andy" ));
58+ 		assertEquals ("exists" , props .getProperty ("Dave" ));
59+ 		assertEquals ("exists also" , props .getProperty ("Andy" ));
60+ 	}
61+ 
62+ 	@ Test 
63+ 	public  void  testSpr5847 () throws  Exception  {
64+ 		assertEquals ("Andy" , andy2 .getName ());
65+ 		assertEquals ("Andy" , andy .getName ());
4566	}
46- 	
67+ 
68+ 
4769	public  static  class  Foo  {
70+ 
4871		private  String  name ;
4972
73+ 
5074		public  String  getName () {
5175			return  name ;
5276		}
5377
5478		public  void  setName (String  name ) {
5579			this .name  = name ;
5680		}
57- 
58- 	}
59- 
60- 	@ Autowired 
61- 	@ Qualifier ("andy2" )
62- 	private  Foo  andy2 ;
63- 
64- 	@ Autowired 
65- 	@ Qualifier ("andy" )
66- 	private  Foo  andy ;
67- 
68- 	@ Test 
69- 	public  void  testSpr5847 () throws  Exception  {
70- 		assertEquals ("Andy" , andy2 .getName ());
71- 		assertEquals ("Andy" , andy .getName ());
7281	}
7382
74- }
83+ }
0 commit comments