日期:2014-05-20  浏览次数:20730 次

Thinking in Java第四版《注解》这章的这个程序为什么没有运行结果。
package chapter20_annotations;

import net.mindview.atunit.*;
import net.mindview.util.*;
/**
 *@Name:
 *@Date:Jul 2, 2011 10:56:44 AM
 *@TODO:基于注解的单元测试
 */
public class AtUnitExample {
public String methodOne(){
return "Method1";
}

public int methodTwo(){
System.out.println( "Method2");
return 2;
}

@Test boolean methodOneTest(){
return methodOne().equals("Method1");
}

@Test boolean m2(){
return methodTwo()==2;
}

@Test private boolean m3(){
return true;
}

@Test boolean failureTest(){
return false;
}

@Test boolean anotherDisappointment(){
return false;
}

public static void main(String args[]){
OSExecute.command("java net.mindview.atunit.AtUnit AtUnitExample");
}


}


------解决方案--------------------
mark
------解决方案--------------------
mark too
------解决方案--------------------
把@Test都去掉
OSExecute.command("java net.mindview.atunit.AtUnit AtUnitExample");
你是没有OSExecute这个类的
这是作者自己在
net.mindview.atunit.*;
net.mindview.util.*;
这两个包中实现的

所以你的程序根本无法运行
得不到结果
------解决方案--------------------
缺少类啊,OSExecute
探讨
把@Test都去掉
OSExecute.command("java net.mindview.atunit.AtUnit AtUnitExample");
你是没有OSExecute这个类的
这是作者自己在
net.mindview.atunit.*;
net.mindview.util.*;
这两个包中实现的

所以你的程序根本无法运行
得不到结果