Over a million developers have joined DZone.

An Adapter to use Hamcrest Matchers as AssertJ Conditions

· Java Zone

Navigate the Maze of the End-User Experience and pick up this APM Essential guide, brought to you in partnership with CA Technologies

Following on from yesterday’s post on AssertJ, here’s a tiny github repo that I put together with some utilities for AssertJ.

The first is the script mentioned yesterday, tidied up a little and renamed.

The second is a little adapter class that allows you to use Hamcrest Matchers as AssertJ Conditions.  So, if you have some really complex Hamcrest matcher stuff, you can migrate it easily:

final String actual = "how now brown cow";
    assertThat(actual).is(matchedBy(Matchers.containsString("now brown")));

The adapter is provided by that “matchedBy” factory method.  But the github repo has a full README for details.

Thrive in the application economy with an APM model that is strategic. Be E.P.I.C. with CA APM.  Brought to you in partnership with CA Technologies.


Published at DZone with permission of Dan Haywood, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}