读书人

Thinking in Java第四版《注解》这章的

发布时间: 2012-01-15 22:57:49 作者: rapoo

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.*;
这两个包中实现的

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

读书人网 >J2SE开发

热点推荐