1 package com.imooc.test.aware;
2
3 import org.junit.Test;
4 import org.junit.runner.RunWith;
5 import org.junit.runners.BlockJUnit4ClassRunner;
6
7 import com.imooc.test.base.UnitTestBase;
8
9 @RunWith(BlockJUnit4ClassRunner.class)
10 public class TestAware extends UnitTestBase {
11 static {
12 System.out.println("-----TestAware static{}------");
13 }
14
15 public TestAware() {
16 // 父类构造器
17 super("classpath:spring-aware.xml");
18 System.out.println("TestAware Construct()...");
19 }
20
21 // @Test
22 // public void testMoocApplicationContext() {
23 // System.out.println("testMoocApplicationContext : " +
24 // super.getBean("moocApplicationContext").hashCode());
25 // }
26
27 @Test
28 public void textMoocBeanName() {
29 /*
30 * 使用@Test注解对某个类A里的b方法进行测试的时候,程序的执行顺序依次是
31 *
32 * 1 静态代码块(如果有的话)
33 *
34 * 2 A类的构造器里的代码
35 *
36 * 3 b方法里的代码
37 */
38 System.out.println("textMoocBeanName : " + super.getBean("moocBeanName").hashCode());
39 }
40
41 }