下面请把 com/company/HelloWorld.java文件中的return "Hello World!";改成return "Hello world!!",并在../JunitTest/builde目录运行下运行ant runtests。
我们会看到如下情形:
……………………………………
……………………………………
runtests:
[junit] .F
[junit] Time: 0.01
[junit] There was 1 failure:
[junit] 1) testSayHello(test.com.company.HelloWorldTest)junit.framework.Comp
arisonFailure: expected:<...World...> but was:<...world!...>
[junit] at test.com.company.HelloWorldTest.testSayHello(Unknown Source)
[junit] at sun.reflect.NativeMethodAclearcase/" target="_blank" >ccessorImpl.invoke0(Native Method)
[junit] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
sorImpl.java:39)
[junit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
hodAccessorImpl.java:25)
[junit] FAILURES!!!
[junit] Tests run: 1, Failures: 1, Errors: 0
BUILD FAILED
我们可以看到,这是JUNIT测试用例未正常运行通过的错误信息。