在項目中加入junit-x.x.jar包
在MyEclipse在package上右鍵 可以找到 Junit
Test Case
只要在合適的包中 一般在對應待測試類的test包中 新建Junit Test Case
然后可以選擇 對哪個類 的哪個方法進行測試
MyEclipse就會自動生成測試類框架
如果要用4以上推出的 assertThat(T actual,org.hamcrest.Matcher<T> matcher)方法
需要引入hamcrest中的hamcrest-core.jar hamcrest-library.jar兩個包
由assertThat第二個參數名可以看出 是由hamcrest定義的
English » | | | | | | | | |
Text-to-speech function is limited to 100 characters