JUnit4_3

@Test @Ignore @BeforeClass @Before @After @AfterClass

/**
*
*/
package com.ailk;

import static org.junit.Assert.*;

import static org.hamcrest.core.Is.*;

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

/**
* @author Administrator
*
*/
public class TTest {
    @BeforeClass
    public static void BeforeClass() {
        System.out.println("BeforeClass");
    }
    @Before
    public void Before() {
        System.out.println("Before");
    }

    /**
     * Test method for {@link com.ailk.T#add(int, int)}.
     */
    @Test
    public void testAdd() {
        T t = new T();
        int z = t.add(3, 5);
        assertEquals(8, t.add(3, 5));
        assertThat(z, is(8));
        System.out.println("testAdd over!");
    }
    @Ignore
    public void testSub(){
    }
    @After
    public void After() {
        System.out.println("After");
    }
    @AfterClass
    public static void AfterClass() {
        System.out.println("AfterClass");
    }
}

posted @ 2011-05-16 07:43  Soladin  阅读(197)  评论(0编辑  收藏  举报