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");
 }
}

posted on 2009-11-03 21:12  IT Person  阅读(227)  评论(0)    收藏  举报