现在的位置: 首页 > 综合 > 正文

Junit中的注释1

2012年10月10日 ⁄ 综合 ⁄ 共 669字 ⁄ 字号 评论关闭

package junit.test;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

public class AnDemo {
 //define a test method
 @Test
 public void add() {
  assertEquals(2, 2);
 }
 
 //init every test method
 @Before
 public void ttttdiv() {
  
 }
 
 //destory
 @After
 public void ttttdiv2() {
  
 }
 
 //init once must static
 @BeforeClass
 public static void setUpBeforeClass() {
  
 }
 
 //must static
 @AfterClass
 public static void teardownAfterClass() {
  
 }
 
 @Test(expected=ArithmeticException.class)
 public void ex() {
  
 }
 
 @Test(timeout=100)
 public void ex2() {
  
 }
 public static void main(String[] args) {
  System.out.println("Hello");
 }
}

抱歉!评论已关闭.