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.

Hamcrest number comparison using between

Is there a way in Hamcrest to compare a number within a number range? I am looking for something like …

java hamcrest
How to count RecyclerView items with Espresso

Using Espresso and Hamcrest, How can I count items number available in a recyclerView? Exemple: I would like check if 5 …

android android-recyclerview android-espresso hamcrest
assertThat - hamcrest - check if list is sorted

Ok I think its going to be a short question. I have an ArrayList that I sorted by date, of …

java junit hamcrest
Java 8 - retry a method until a condition is fulfilled (in intervals)

I want to create a class that can run a method until a condition about the return value is fulfilled. …

java java-8 hamcrest
Assert that the list is not empty - with or without Hamcrest?

This is related to Checking that a List is not empty in Hamcrest I have a question over that - …

java collections junit hamcrest
onChildView and hasSiblings with Espresso

I am trying to access a button from a specific view. The same view is displayed 6 times. This is the …

android android-testing hamcrest android-espresso
Rewriting "assertTrue" into "assertThat" in JUnit?

List<String> list1 = getListOne(); List<String> list2 = getListTwo(); Given the code above, I want to use …

junit hamcrest
How do I use Hamcrest with JUnit 5 when JUnit 5 doesn't have an assertThat() function?

To use Hamcrest with JUnit 4 we use an assertThat() function. However, JUnit 5 is no longer going to have an assertThat() …

java junit5 hamcrest assertthat
Java Hamcrest : Collection contains item of type

I'd like to assert that List<Achievement> contains a member of type TestAchievement. Here's my assertion: List<…

java unit-testing hamcrest
"Unchecked generic array creation for varargs parameter of type Matcher <? extends String> []" warning using CoreMatchers.allOf()

In my UT code, extract below, I see warning : Unchecked generic array creation for varargs parameter of type Matcher <? …

java generics generic-collections hamcrest