1 /*
2  * Copyright 2002-2011 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package org.springframework.test.context.junit4.annotation;
18 
19 import static org.junit.Assert.assertEquals;
20 import static org.junit.Assert.assertNotNull;
21 
22 import org.junit.Test;
23 import org.junit.runner.RunWith;
24 import org.springframework.beans.Pet;
25 import org.springframework.beans.factory.annotation.Autowired;
26 import org.springframework.test.context.ContextConfiguration;
27 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
28 import org.springframework.test.context.support.AnnotationConfigContextLoader;
29 
30 /**
31  * Integration tests that verify support for configuration classes in
32  * the Spring TestContext Framework.
33  *
34  * <p>Configuration will be loaded from {@link DefaultConfigClassesInheritedTests.ContextConfiguration}
35  * and {@link DefaultConfigClassesBaseTests.ContextConfiguration}.
36  *
37  * @author Sam Brannen
38  * @since 3.1
39  */
40 @RunWith(SpringJUnit4ClassRunner.class)
41 @ContextConfiguration(loader = AnnotationConfigContextLoader.class, classes = DefaultConfigClassesInheritedTests.ContextConfiguration.class)
42 public class ExplicitConfigClassesInheritedTests extends ExplicitConfigClassesBaseTests {
43 
44 	@Autowired
45 	private Pet pet;
46 
47 
48 	@Test
verifyPetSetFromExtendedContextConfig()49 	public void verifyPetSetFromExtendedContextConfig() {
50 		assertNotNull("The pet should have been autowired.", this.pet);
51 		assertEquals("Fido", this.pet.getName());
52 	}
53 
54 }
55