logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benedikt Ritter <brit...@apache.org>
Subject Re: Question/suggestion regarding use of assertions in unit tests.
Date Sun, 05 Jan 2014 18:16:00 GMT
2014/1/5 Matt Sicker <boards@gmail.com>

> There are no receivers for the messages because they're functional rather
> than OO. When it comes to unit tests, though, I feel that remaining
> strictly OO makes them awkward.
>

Nicely said.


>
>
> On 5 January 2014 08:34, Gary Gregory <garydgregory@gmail.com> wrote:
>
>> 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
>> Date:01/05/2014 04:49 (GMT-05:00)
>> To: Log4J Developers List
>> Cc: log4j-dev@logging.apache.org
>> 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 <boards@gmail.com> 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 <boards@gmail.com>
>>
>>
>
>
> --
> Matt Sicker <boards@gmail.com>
>



-- 
http://people.apache.org/~britter/
http://www.systemoutprintln.de/
http://twitter.com/BenediktRitter
http://github.com/britter

Mime
View raw message