Some useful new Hamcrest matchers for collections | Java.net
Forums Blogs Projects People Some useful new Hamcrest matchers for collections Posted by johnsmart on December 12, 2011 at 12:31 PM PST Hamcrest is a neat little library that lets you write more fluent and readable tests. For example, rather than writing: assertEquals("red", color); assertThat(color,is("red")); This makes for tests that express their intent much more clearly, which in turn makes the tests easier to understand and to maintain, and more likely to be correct. This is generally considered to be a Good Thing. A version of Hamcrest is actually bundled with JUnit. However it is somewhat dated, and the more recent versions of Hamcrest come with a lot more features, particularly with regards to working with collections. You can use the latest version of Hamcrest by using the junit-depRead full article from Some useful new Hamcrest matchers for collections | Java.net
No comments:
Post a Comment