I've not been a Hamcrest fan. It feels to much like a DL that makes for funky looking tests. In general I do not like static imports for non-constants because it is not OO, You cannot tell who the receiver of a message is.
Gary -------- Original message -------- From: Ralph Goers <[email protected]> Date:01/05/2014 04:49 (GMT-05:00) To: Log4J Developers List <[email protected]> Cc: [email protected] Subject: Re: Question/suggestion regarding use of assertions in unit tests. The tests weren't migrated from junit 3, although I spent many years working with it. Frankly, until I saw your patch today I was unaware of directly using Hamcrest. Since junit uses it I really have no problem if we do if it makes the tests more readable. Ralph On Jan 5, 2014, at 12:38 AM, Matt Sicker <[email protected]> wrote: Hi all, newcomer here. I'm wondering what your opinions are on using Hamcrest matchers in unit tests. That is, using the assertThat() methods and the matchers that go with it. It makes many otherwise hard to read assertions far more literate, plus it provides some nice error messages explaining why an assertion failed (unlike the native assert keyword and certain related methods in org.junit.Assert). I don't know if the tests were migrated from JUnit 3 or anything, but I do believe it's the preferred way of asserting things in JUnit. And before anyone says something like "patches welcome", I'd be glad to help update unit tests for such a thing. :) -- Matt Sicker <[email protected]>
