| Newsgroups |
gmane.comp.java.junit.user |
| Message-ID |
<[email protected]> |
Hi Mark,
to me, all assert* methods should be moved out of JUnit=E2=80=99s core libr=
ary. At the time they have been introduced, there were (hardly) no assertio=
n libraries. Nowadays, there are a lot and most of them are quite powerful =
so that they've replaced the assert* methods of JUnit totally. Even more: J=
Unit added support for hamcrest with the assertThat method=E2=80=A6 For me =
this is a clear hint: For modern testing suites, I would not use any of the=
JUnit=E2=80=99s assertions but stick with those of hamcrest or JAssert.
As you know, frameworks should only do one thing, and that one thing right.=
So to me, assertion frameworks should handle assertions, JUnit should perf=
orm tests and report their results. But that=E2=80=99s just my point of vie=
w. Don=E2=80=99t judge me for that. ;-)
All the best
Stefan
> Am 05.10.2015 um 07:17 schrieb Mark Silvis [email protected] [junit] <=
[email protected]>:
>=20
> Stefan,
>=20
>=20
> Thank you for the link. After a cursory glance, it seems like digging int=
o Hamcrest to assert that an optional value is empty, for example, is more =
work for the user than it=E2=80=99s worth. I would rather stick to David=E2=
=80=99s suggestion of assertEquals(x, Optional.empty()) for this case, unle=
ss the assertion was especially complex. Then, as I mentioned to David, tha=
t isn=E2=80=99t nearly as clean (in my opinion) as an assertEmpty would be.
>=20
> Best,
> Mark
>=20
>=20
>> On Oct 5, 2015, at 12:18 AM, Stefan Bechtold [email protected] <mai=
lto:[email protected]>[junit] <[email protected] <mailto:junit@yah=
oogroups.com>> wrote:
>>=20
>>=20
>> Hi Mark
>>=20
>> Actually, I think this sounds more as an addition to a matcher framework=
like hamcrest rather than an addition to JUnit itself. What do you think?
>>=20
>> see also: https://github.com/hamcrest/JavaHamcrest/issues/82 <https://gi=
thub.com/hamcrest/JavaHamcrest/issues/82>
>>=20
>> all the best
>>=20
>> Stefan
>>=20
>>=20
>> Am 04.10.2015 um 19:55 schrieb Mark Silvis [email protected] <mailto:=
[email protected]> [junit] <[email protected] <mailto:junit@yahoogro=
ups.com>>:
>>=20
>>>=20
>>> I would like to contribute to JUnit, and I think I have a good idea for=
a feature. I=E2=80=99ve found that it would be nice to have assertions tha=
t explicitly supported Java 8=E2=80=99s Optional class. I=E2=80=99m thinkin=
g something along the lines of assertEmpty() and assertPresent(). Would suc=
h an addition be welcomed?
>>>=20
>>> Thanks,
>>> Mark
>>>=20
>>=20
>=20
>=20
>=20
[Non-text portions of this message have been removed]
------------------------------------
Posted by: Stefan Bechtold <[email protected]>
------------------------------------