日期:2014-05-20 浏览次数:20712 次
globalInit invoked!
before
Test1
destroy
before
Test2
destroy
before
Test3
destroy
globalDestroy invoked!
globalInit invoked!
before
Test1
destroy
before
destroy
Test2
destroy
before
Test3
globalDestroy invoked!
globalInit invoked!
before
Test1
destroy
before
Test2
destroy
destroy
before
Test3
globalDestroy invoked!
public class TestJUnit4
{
@BeforeClass
public static void globalInit()
{
System.out.println("globalInit invoked!");
}
@AfterClass
public static void globalDestroy()
{
System.out.println("globalDestroy invoked!");
}
@Before
public void setUp()
{
System.out.println("before");
}
@After
public void tearDown()
{
System.err.println("destroy");
}
@Test
public void test1()
{
System.out.println("Test1");
}
@Test
public void test2()
{
System.out.println("Test2");
}
@Test
public void test3()
{
System.out.println("Test3");
}
}