JAvaコードクリップ_3
1508 ワード
package javaee.china.cxp;
import junit.framework.Assert;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
/**
* java
* junit
* @Test
*
* @Before @After (@Before @Test @After @Test )
* @BeforeClass @AfterClass (@BeforeClass @AfterClass @BeforeClass @AfterClass )
* Assert.assertEquals( , );
*/
public class Demo_3_Junit {
private Persion p;
@BeforeClass
public static void beforeClass(){
System.out.println("beforeClass");
}
@Before
public void before(){
p = new Persion();
}
@Test
public void testRun(){
Persion p1 = new Persion();
p1.run();
}
@Test
public void testEat(){
Persion p2 = new Persion();
p2.eat();
}
@Test
public void testEatTwo(){
p.eat();
}
@After
public void after(){
System.out.println("after");
}
@Test
public void sleep(){
Assert.assertEquals(" ", p.sleep());
}
@AfterClass
public static void afterClass(){
System.out.println("afterClass");
}
}