所以这是我的代码:
package tests;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
class StatementTester extends TestCase {
public StatementTester (String name) {
super(name);
}
protected void setUp() {
}
protected void tearDown() {
}
public void test1() {
System.out.println("testing");
assert(true);
}
public static Test suite() {
TestSuite suite= new TestSuite();
suite.addTest(new StatementTester("test1"));
return suite;
}
public static void main (String[] args) {
junit.textui.TestRunner.run (suite());
}
}
当我尝试运行它时,我收到以下错误消息:
.E
Time: 0.001
There was 1 error:
1) test1(tests.StatementTester) at tests.StatementTester.main(StatementTester.java:30)
FAILURES!!!
Tests run: 1, Failures: 0, Errors: 1
我的代码基于 Martin Fowler 的“重构:改进现有代码的设计”的第 4 章中给出的示例(虽然我对其进行了简化,但基本结构是相同的)。另外,我运行 eclipse 3.5.1 并使用 JUnit 3 库(不知道它有多相关,但无论如何......)
你能告诉我我做错了什么吗?