Top "Hamcrest" questions

Hamcrest is an open source library of constraint classes used to match objects and values, typically by other frameworks such as unit testing, mocking, or collections.

How to verify Map size using Hamcrest

Map<Integer, Map<String, String>> mapMap = new HashMap<Integer,Map<String, String>>(); …

java junit hamcrest
Mixing Hamcrest and TestNG

Has anyone integrated Hamcrest with TestNG so that its matchers can easily be used in TestNG assertions?

java testng hamcrest
Interrogation about Spring MVC test API's model().attribute() method

I am trying to test the following controller method using the Spring MVC test API: @RequestMapping(value = "/preference/email", method = …

spring spring-mvc mockito hamcrest spring-mvc-test
Difference between hamcrest-library Matchers and hamcrest-core CoreMatchers

It looks like the hamcrest org.hamcrest.Matchers class is very similar to org.hamcrest.CoreMatchers (though it looks like …

junit hamcrest
Testing content of list ignoring some of the fields

I have a scenario where I receive a list from a method call and I would like to assert that …

java unit-testing hamcrest assertj
Hamcrest equal collections

Is there a matcher in Hamcrest to compare collections for equality? There is contains and containsInAnyOrder but I need equals …

java unit-testing junit assert hamcrest
Hamcrest Matchers.contains matcher not working (?)

I am trying to test if a collection has an item which toString() method returns a particular String. I tried …

java junit hamcrest
Is there a Hamcrest matcher to check that a Collection is neither empty nor null?

Is there a Hamcrest matcher which checks that the argument is neither an empty Collection nor null? I guess I …

java junit matcher hamcrest
Is there any Hamcrest Matcher for java.util.Optional?

I am looking for a Hamcrest Matcher to unit test methods that return a java.util.Optional type. Something like: @…

java unit-testing optional matcher hamcrest
Hamcrest assertThat ambiguous?

I got some samplecode from a college, imported the project and try to run the Tests: The method assertThat(Integer, …

java junit4 hamcrest