我是JUnit和Hamcrest的新手,希望獲得最佳實踐建議,以便我可以決定首先學習哪些文檔。是org.junit.Assert.assert比org.hamcrest.MatcherAssert.assert那個更好嗎?
對於初學者,這些assertThat
方法哪個更好?
- org.junit.Assert.assertThat(來自的junit-4.11.jar)
- org.hamcrest.MatcherAssert.assertThat(從hamcrest芯-1.3.jar)
根據某人今年早些時候,Hamcrest "could potentially give better error messages because the matcher is called to describe the mismatch"。
很難說這些帖子中哪些版本的Junit和Hamcrest進行了比較。所以我想要一個基於最新發布版本的建議。
謝謝dkatzel,知道JUnit沒有經常更新是很有幫助的,所以我可能想包含我自己的Hamcrest版本。這就是我正在尋找的那種知識,所以再次感謝。 – 2014-12-02 18:40:53
@MichaelOsofsky我已經更新了我的答案,我發現他們略有不同,我現在更喜歡hamcrest。 – dkatzel 2014-12-02 18:47:58
謝謝@dkatzel,這真的很有幫助。 – 2014-12-02 18:55:09