junit

junit怎么用?我用myeclipse一步一步弄下去,生成下面的代码:
@BeforeClass
public static void setUpBeforeClass() throws Exception {
}

@AfterClass
public static void tearDownAfterClass() throws Exception {
}

@Before
public void setUp() throws Exception {
}

@After
public void tearDown() throws Exception {
}

@Test
public final void testFindnode() {
fail("Not yet implemented"); // TODO
}

@Test
public final void testGetDoc() {
fail("Not yet implemented"); // TODO
}

@Test
public final void testMain() {
fail("Not yet implemented"); // TODO
}
怎么会生成这样的代码?难道还要自己写代码?

要自己写的,你可以看看这篇文章
http://niatwangcong.iteye.com/blog/292820

或者运行下面的例子: (MyEclipse中 右键 - Run As - JUnit Test)
其中,加了@Test注解的方法是需要你写测试用例的。

import static org.junit.Assert.*;
import org.junit.*;
public class TestA {

@Before
public void before() {
    System.out.println("@Before");
}

@Test
public void test1() {
    System.out.println("@Test");
    assertEquals(10, 10);
}

@Test
public void test2() {
    System.out.println("@Test");
    assertEquals(10, 10);
}

@After
public void after() {
    System.out.println("@After");
}

@BeforeClass
public static void beforeClass() {
    System.out.println("@BeforeClass");
};

@AfterClass
public static void afterClass() {
    System.out.println("@AfterClass");
};

}