Top "Matcher" questions

Matchers are objects used among other things by testing libraries to check, if an object matches an abstract description of an expected state.

How to show custom failure messages in ScalaTest?

Does anyone know how to show a custom failure message in ScalaTest? For example: NumberOfElements() should equal (5) Shows the following …

scala scalatest matcher
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
java regex to exclude specific strings from a larger one

I have been banging my head against this for some time now: I want to capture all [a-z]+[0-9]? character …

java regex regexbuddy matcher
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
Rspec view testing with capybara and rails3

I really like the way RSpec is able to separate controller and view tests but have some problems with getting …

ruby-on-rails-3 configuration rspec capybara matcher
Matching multiple properties in one Matcher

I need to write Matcher which will check multiple properties. For single property i've used: import static org.hamcrest.Matchers.…

java mockito matcher hamcrest
Jest Equality Matcher For Strings That Disregards Whitespace

Jest's toEqual matcher takes whitespace into account when checking for equality. When formatting the expected value in tests it is …

javascript string jestjs matcher html-escape-characters
Mocha/Chai testing expected vs actual arrays of objects

What's the best way to assert that the expected results matches the actual results when both are arrays of objects? …

javascript testing mocha.js matcher chai
During suite tests EasyMock says 0 matchers expected 1 recorded

So I've been using EasyMock's class extension for a while now. All of a sudden I'm getting this exception, but …

easymock matcher
Mock a method with an object parameter with Mockito

In my unit test i want to mock the interaction with elasticsearch by doing the following when(cityDefinitionRepository.findCitiesNearby(geoPoint, …

java unit-testing mockito matcher stubbing