Over a million developers have joined DZone.

Consider assertThat() in place of assertEquals()

· Java Zone

Learn more about Kotlin, a new programming language designed to solve problems that software developers face every day brought to you in partnership with JetBrains.


JUnit 4.4 added a new assertion mechanism with the method assertThat(). Have a look and consider using it in place of assertEquals().

assertThat(result, is(42));
assertThat(output, containsString("foo"));

The Java Zone is brought to you in partnership with JetBrains.  Discover how powerful static code analysis and ergonomic design make development not only productive but also an enjoyable experience.


Published at DZone with permission of Mike Christianson , DZone MVB .

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}