以下再idea中使用Junit测试
package PFP.Test;
/**
* Created by lichen on 2017/8/12.
*/
public class Person {
public void run(){
System.out.println("run");
}
public void eat(){
System.out.println("eat");
}
}
package PFP.Test;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
/**
* Created by lichen on 2017/8/12.
*/
public class JunitTest {
private Person p;
@Before
public void before(){
p=new Person();
}
@Test
public void testRun(){
p.run();
}
@Test
public void testEat(){
p.eat();
}
@After
public void after(){
p=null;
}
}
出现原因 ,没有make编译成Person.class和JunitTest.class 先make再运行 通过