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.

Mockito match any class argument

Is there a way to match any class argument of the below sample routine? class A { public B method(Class&…

java class mockito arguments matcher
Mockito: List Matchers with generics

Mockito offers: when(mock.process(Matchers.any(List.class))); How to avoid warning if process takes a List<Bar&…

java generics warnings mockito matcher
PatternSyntaxException: Illegal Repetition when using regex in Java

I don't know much regex, but I need to match a simple pattern. The following should return true, Pattern.matches("{\"…

java regex matcher
How to extract parameters from a given url

In Java I have: String params = "depCity=PAR&roomType=D&depCity=NYC"; I want to get values of …

java regex matcher
Why doesn't this code attempting to use Hamcrest's hasItems compile?

Why does this not compile, oh, what to do? import static org.junit.Assert.assertThat; import static org.junit.matchers.…

java unit-testing junit hamcrest matcher
What's the difference between Mockito Matchers isA, any, eq, and same?

I am confused on what's the difference between them, and which one to choose in which case. Some difference might …

java unit-testing mockito difference matcher
How Matcher.find() works

I am testing a small stub of Matcher and Pattern class...see the following small stub.. package scjp2.escape.sequence.…

java regex matcher
When to use ** (double star) in glob syntax within JAVA

Directly from this Java Oracle tutorial: Two asterisks, **, works like * but crosses directory boundaries. This syntax is generally used for …

java path nio glob matcher
Java - Regex for Full Name

How can I validate regex for full name? I only want alphabets (no numericals) and only spaces for the regex. …

java regex string validation matcher
EasyMock : java.lang.IllegalStateException: 1 matchers expected, 2 recorded

I am having a problem with EasyMock 2.5.2 and JUnit 4.8.2 (running through Eclipse). I have read all the similar posts here …

java easymock matcher