Repository: mockito/mockito
Issue: Tweaks Matchers.any family matchers behavior
Labels: refactoring
1.* incompatible

This issue is a follow up of the work started in #141 by @pimterry. Also here's an extract of a message on [this thread](https://groups.google.com/forum/#!topic/mockito/8_WGBB3Jbtk) of the mailing list :

---

The origin of these methods is they come from `anything` i.e. anything matches, later for shortness and cast avoidance the aliases grew, but the API naming thus became inconsistent with what a human would expect. So this behavior is being changed in mockito 2 beta, to be precise here's the status on these API in the version 2.0.5-beta :
- `any`, `anyObject`, `any(Class)` won't check anything (at first they were just aliases for _anything_ and for cast avoidance), `null` is a valid value
- `anyX` like `anyString` will check the arg is not `null` and that has the correct type
- `anyList` will check the argument is not null and a `List` instance
- `anyListOf` (and the likes) at the moment are just aliases to their non generic counter part like `anyList`

Note this is work in progress (started here in [#141](https://github.com/mockito/mockito/pull/141)), these new behavior can / will change in the beta phase. I'm especially wondering if the `any` family should allow `null` and if not do a type check. For example with these matchers : 
- `any`, `anyObject` stay the same, they currently allow `null` and don't have to do type check anyway
- `any(Class)` currently allows `null` and doesn't do type check => allows `null` and if not checks for the given type
- `any<Collection>Of` currently doesn't allow `null` and does a type check of the collection, not elements => allows `null`, if not checks collection type, if not empty checks element type

Maybe extend/create a _symmetric_  `isA` family API that won't allow any `null` arguments.

---


Issue comments:
`any` family is currently _(at his time up to 2.0.5-beta)_ inconsistent on the way they allow or not `null`s. Type checking is ok, but `null` check behavior consistency is also important.

AnyX gramtaically tends to imply to return false for null because any
object is not null. I agree completely the api should be consistent.

On Sun, Apr 5, 2015, 11:54 Brice Dutheil notifications@github.com wrote:

> any family is currently _(at his time up to 2.0.5-beta)_ inconsistent on
> the way they allow or not nulls. Type checking is ok, but null check
> behavior consistency is also important.
> 
> ## 
> 
> Reply to this email directly or view it on GitHub
> https://github.com/mockito/mockito/issues/194#issuecomment-89831862.

> AnyX gramtaically tends to imply to return false for null because any object is not null.

I'm not anymore of sure of that. Anyway the changes introduced in this API make it inconsistent.
That's why I propose any validates `null`, and if not `null` then validates the type

Also on the mentioned thread _Francisco Olarte_ was proposing a `anyNotNull` family, this could clarify the behavior on `null` of these APIs.

Agreed. Any should return false for null and false for wrong type (instance
of). Otherwise I think it would violate the principle of least surprise.

On Sun, Apr 5, 2015, 12:57 Brice Dutheil notifications@github.com wrote:

> AnyX gramtaically tends to imply to return false for null because any
> object is not null.
> 
> I'm not anymore of sure of that. Anyway the changes introduced in this API
> make it inconsistent.
> That's why I propose any validates null, and if not null then validates
> the type
> 
> Also on the mentioned thread _Francisco Olarte_ was proposing a anyNotNull
> family, this could clarify the behavior on null of these APIs.
> 
> ## 
> 
> Reply to this email directly or view it on GitHub
> https://github.com/mockito/mockito/issues/194#issuecomment-89842760.

I see anyString() ( and friends ) checking for null and anyObject() not doing it as an inconsistency potentially leading to user surprise. Object is as much of a class as String ( or other ).

Other thing is I fail to see is the difference ( if there is any ) between isA(Klazz) and notNull(Klazz) ( or IsNotNull, but I see that one is a forwarder ). To me they seem they do the same, given the docs, but the code is different and I'm not familiar enough with it to assert they do the same thing. When doing DSL helper libraries I've found ( the hard way ) having slightly different names for the same thing seems a good idea initially, but leads to problem along the way, so I would vote for just having one of notNull/isNotNull ( and isA if it is functionally equivalent ).

I think there might be confusion here: @szczepiq I don't think the two of you are agreeing. @bric3 seems to be saying that `any` should match nulls and anyNotNull should exist (and presumably not match null), while you're saying that `any` should not match null.

I think the problem here is that there's two use cases that currently aren't clearly separated, both of which we need to support.
1. I don't care what the value I'm matching is _at all_, I want a very simple intuitive wildcard matcher that will match absolutely anything, and will compile with no extra effort (so no casts).
2. I care about the type of the value that I'm matching, but no details beyond that. I want a matcher that will not match values with the wrong type.

I think both of these are major common use cases. If we make any of the `anyX()` methods reject nulls, they no longer support the first case, and if we leave it as-is then they currently appear to support the 2nd case but aren't really doing so, which is where all this came from originally.

I do think any API that supports use case 2 should reject nulls by default: if you're asserting specifically on the type of the value, we should push people to be clear about whether or not null is valid in the given case. I think an API for use case 1 should not reject nulls, because you want to match _everything_.

These are two quite different APIs though, and to get any kind of API consistency, we're going to need them to be separate sets of methods. I suggest:
- `any()` - matches absolutely anything, including nulls, as a generic method returning T (as now)
- `anyAsX()` and `anyAs(X.class)` - matches absolutely anything, including nulls, as a generic method returning X
  - This is as in 1.9, but with the names changed to make it clear that this is purely a type casting concern, not type checking, and intentionally being a bit more verbose to discourage unnecessary use.
  - Note that as of Java 8 target type inference considers method arguments, so you should be able to use `any()` in every case except choosing between overloaded methods (pretty rare?). In addition, note that Java 7's final update is this month, and then it's unsupported.
  - We'd also obviously document that users should prefer isA etc if they want to check the type, but I think it's much more obvious that `anyAsString()` isn't actually checking the value's a string (unlike `anyString()`, which did suggest that).
- `isA/isAn(X.class)` and `isAnX()` - matches on type, rejecting nulls
- `isNullOrAn(X.class)` and `isNullOrAnX()` - matches on type, accepting nulls

I think this makes for a relatively small change, so gives fairly easy migration, but makes it clear that the `any()` methods are all just generic wildcards (for use case 1), and provides a clear set of other methods to support actual type checking and pushing users to be clear about nullability along the way (for use case 2).

The only other option I can see we might want to do is stop supporting use case 1 entirely, make everybody be much more specific about what they want, and reject nulls everywhere. I think use case one is likely to be the most common case for use argument matchers anywhere though, far more than anything else, and we definitely definitely need to support it as an intuitive easy first-class citizen.

Thoughts? Do people agree both use cases are common and important? Does anybody have a better solution to help us get both while keeping a sensible consistent API?

On Tue, Apr 7, 2015 at 5:12 PM, Tim Perry notifications@github.com wrote:

> These are two quite different APIs though, and to get any kind of API
> consistency, we're going to need them to be separate sets of methods. I
> suggest:
> - any() - matches absolutely anything, including nulls, as a generic
>   method returning T (as now)
> - anyAsX() and anyAs(X.class) - matches absolutely anything, including
>   nulls, as a generic method returning X
>   - This is as in 1.9, but with the names changed to make it clear
>     that this is purely a type casting concern, not type checking, and
>     intentionally being a bit more verbose to discourage unnecessary use.
>   - Note that as of Java 8 target type inference considers method
>     arguments, so you should be able to use any() in every case except
>     choosing between overloaded methods (pretty rare?). In addition, note that
>     Java 7's final update is this month, and then it's unsupported.
>   - We'd also obviously document that users should prefer isA etc if
>     they want to check the type, but I think it's much more obvious that
>     anyAsString() isn't actually checking the value's a string (unlike
>     anyString(), which did suggest that).
>     - isA/isAn(X.class) and isAnX() - matches on type, rejecting nulls
> - isNullOr(X.class) and isNullOrX() - matches on type, accepting nulls
> 
> I think this makes for a relatively small change, so gives fairly easy
> migration, but makes it clear that the any() methods are all just generic
> wildcards (for use case 1), and provides a clear set of other methods to
> support actual type checking and pushing users to be clear about
> nullability along the way (for use case 2).
> 
> The only other option I can see we might want to do is stop supporting use
> case 1 entirely, make everybody be much more specific about what they want,
> and reject nulls everywhere. I think use case one is likely to be the most
> common case for use argument matchers anywhere though, far more than
> anything else, and we definitely definitely need to support it as an
> intuitive easy first-class citizen.
> 
> Thoughts? Do people agree both use cases are common and important? Does
> anybody have a better solution to help us get both while keeping a sensible
> consistent API?

​I agree all are used and importants.

I'm still struggling with the difference between `isNullOr(X.class)` and `anyAs(X.class)`. The only difference I see is if I have a class `A` with a subclass `subA`, and a class `B` with a subclass `subB`, and a couple of methods `M(A)` and `M(B)` is that `M(anyAs(subB.class))` will select `M(B)` and match on a `B`, but `M(isNullOr(subB.class)` will select it and match only on a `subB`, so I could have a broader matcher for `M(isNullOr(B.class))`.

Even if this is the case, I would just suppress the `anyAs(X.class)`, as my contrived example could be better written as `anyAs(B.class)`, In which case I would rename isNullOr to any, and isA to anyNotNull. In the naming side I find `any()` ​natural, `anyAs` forced, as I consistently read `any(X.class)`
as _'any thing which can be assigned to a variable of type X'_.

So I would end up with only two method names, any and `anyNotNull` with a parameterless plus a class parameter variant ( discounting typeing helpers like `anyNotNullString`), which would work:
1. `anyNotNull`, in any variant, does not accept nulls, any does.
2. A parameterless `any()`/`anyNotNull()` is equivalent to the same method with the declared parameter class. Note, if you can use `any[NotNull]()` in the methods there are no overloads, and the language guarantees I cannot use an incorrect type.

So, if I have a method `M(List l)`, `M(any(ArrayList.class))` would match anything which can be stored in an `ArrayList` var, subclasses and `null` included, and `anyNotNull(ArrayList.class)` will need a not null one. `M(any())` would exactly as `M(any(List.class))`. Mockito cannot check it, but I cannot write code to call `M` with a non-list argument, java is type checked. Same goes for `anyNotNull`.

OTOH, if I have `M(Set s)` too, I must use `M(any(Set.class))` or `M(any(List.class))`, just to resolve the overload, although in this case the matcher type checking is superfluous.

I do not see the point on `any(X.class)` not checking the type and having `isA(X.class)` which does, it seems confusing to me, so my proposal is basically zapping any of the variants. I mean, from the description, in the overloaded method, `M(any(ArrayList.class))` will select the list variant but
match a call with any `List` subtype, while `isNullOr(ArrayList.class)` will only match `ArrayList`s ?. I do not see this has any real use ( the parameter type must be accessible in the test, if you want any List, use `isNullOr(List.class)`).

Maybe I'm missing something, but I see `any(X.class)` redundant, better served by `isNullOr`, the rest is just naming disagreement.

​Francisco Olarte.​

The issue with getting rid of `anyAs(X.class)` is that we want two things:
- A way to match an argument without checking anything about its value (any)
- A way to match an argument and check its type (isA)

I think your solution is to just use `any()` with no parameter everywhere to cover the first case, and specify the type when you want the 2nd case. That won't work, because target type inference doesn't work for method arguments in Java < 8, so it's impossible to use any() without an argument (unless the parameter is just `Object` typed).

Specifically, in Java 7 the below won't compile:

``` java
class X {
   public bool method(List l) { ... }
}

X x = mock(X.class);

// ERROR: method(java.collections.List) cannot be applied to (java.lang.Object)
when (x.method(any()).thenReturn(true);
```

Anybody on Java < 8 has to specify the type every time they match anything, or it's impossible to make it compile. They can never really use `any()`; they always have to use `any(X.class)` (or equivalent). We need a way in Java 7 that you can say 'match absolutely anything please' that compiles, and I think `any(X.class)` or equivalent is the only option.

If you make that `any(X.class)` matcher check the type (as you suggest) then it no longer matches everything any more, and it becomes impossible to wildcard match everything in Java < 8 (without casting, but that would be pretty nasty)

Therefore if you want to be able to both match specific types and wildcard 'match everything' in Java < 8, you have to have two separate APIs to do so. The names of those APIs need to clearly tell the user which of those two things they're doing ('match anything, but cast the matcher to make it compile' vs 'match only this type').

I don't think that's avoidable. I'm very happy to take better suggestions for `anyAs(X.class)` that make it clearer it's just a convenient casting method (without making it so nasty that it stops being convenient), but that method does still need to exist I think.

In addition to all that: we'd rather the 'match a specific type' matcher didn't accept nulls by default (as your `any(List.class)` does). We need to make people opt in to matching nulls, because it's good practice, and because there's some potentially confusing behaviour there as nulls are kind of outside the type system. We also can't have the wildcard matcher reject nulls, or it's not matching everything any more. Thus, again, they need to be two different methods.

Hi Tim:

On Tue, Apr 7, 2015 at 7:37 PM, Tim Perry notifications@github.com wrote:

> The issue with getting rid of anyAs(X.class) is that we want two things:
> 
> A way to match an argument without checking anything about its value (any)
> A way to match an argument and check its type (isA)
> 
> I think your solution is to just use any() with no parameter everywhere to cover the first case, and specify the type when you want the 2nd case. That won't work, because target type inference doesn't work for method arguments in Java < 8, so it's impossible to use any() without an argument (unless the parameter is just Object typed).

I don't think you've understood my solution. From the previously
propossed one ( any() + anyAs(Class) + isA(Class) + isNullOrA(class) (
- notNull(), which is in another place ) I propose to remove anyAs,
  given it does not check type, rename isA(Class) to anyNotNull(Class),
  rename isNullOrA(Class) to any(Class) and rename ( or forward )
  notNull() to anyNotNull().

> Specifically, in Java 7 the below won't compile:
> 
> class X {
>    public bool method(List l) { ... }
> }
> 
> X x = mock(X.class);
> 
> // ERROR: method(java.collections.List) cannot be applied to (java.lang.Object)
> when (x.method(any()).thenReturn(true);

Perfect, in this case you use the propossed isNullOrA(Class), which I
proposed to rename as any(Class).

Also, just grepped and got this from one of my test files:

```
    AC1 = mock(AutoCaller.class);
    when(AC1.makeCall((AcCallRequest) any())).thenReturn(resp1);
```

In case you wonder, AutoCaller is an interface with a method
"MakeCallResponse makeCall(AcCallRequest)", not overloaded.

I think this is clearly superior in java 7 ( I'm unable to use java 8
on those projects due to problems with the app server ). The any()
conveys the 'i do not care, just make this compile' and the cast
clearly says 'this is due to one of those java 7 shortcomings' to me.

> Anybody on Java < 8 has to specify the type every time they match anything, or it's impossible to make it compile. They can never really use any(); they always have to use any(X.class) (or equivalent). We need a way in Java 7 that you can say 'match absolutely anything please' that compiles, and I think any(X.class) or equivalent is the only option.

Which is what I proposed, you have IsNullOrA(Class), which covers
this. Correct me if wrong.

> If you make that any(X.class) matcher check the type (as you suggest) then it no longer matches everything any more, and it becomes impossible to wildcard match everything in Java < 8 (without casting, but that would be pretty nasty)

It is. The Method has a declared argument type of List, which means
the compiler will check that when you use the mock, in
x.method(whatever) whatever implements List, so isNullOrA(List.class),
or any(List.class) will allways match whatever, with an extra
redundant type check.

> Therefore if you want to be able to both match specific types and wildcard 'match everything' in Java < 8, you have to have two separate APIs to do so. The names of those APIs need to clearly tell the user which of those two things they're doing ('match anything, but cast the matcher to make it compile' vs 'match only this type').

As I said, I'm not knowdledgeable enough and haven't got time
presently to dig through the sources. If any(List.class) matches when
I pass an ArrayList to the Mock I can always wildcard by using the
declared argument type.

> I don't think that's avoidable. I'm very happy to take better suggestions for anyAs(X.class) that make it clearer it's just a convenient casting method (without making it so nasty that it stops being convenient), but that method does still need to exist I think.

Forget about my proposed renaming., With the any/anyAs/isA/IsNullOrA
proposal, is there any case in which you must use anyAs() which cannot
be solved by using isNullOrA(X.class)? I think they are synonims. The
problem I see with anyAs as stated is that, in the previous example (
without overloads ), I could code a matcher as
when(x.method(anyAs(ArrayList.class))) and it shoud fire ( as it does
not check type ) when I do x.method(new LinkedList()). I think this is
confusing and asking for problem, and by making it check the type I
could make when(x.method(anyAss(ArrayList.class))) to catch one
specific thing and after that add when(x.method(anyAs(List.class)) for
a catch all in java<8, or just plain any() in >=8.

My proposal of getting rid of anyAs can be read the other way, make
anyAs() check type and get rid of isNullOrA.

Repeating my self, I proposed to get rid of anyAs(Class) as a I feel
it seems to match something which it does not, and it cannot do
anything which cannot be done with isNullOr(class). Name it whatever,
is the functionality with worries me.

> In addition to all that: we'd rather the 'match a specific type' matcher didn't accept nulls by default (as your any(List.class) does). We need to make people opt in to matching nulls, because it's good practice, and because there's some potentially confusing behaviour there as nulls are kind of outside the type system. We also can't have the wildcard matcher reject nulls, or it's not matching everything any more. Thus, again, they need to be two different methods.

That's another thing. What I propose is to simplify so I have two
names ( anyIncludingNull, anyNotNull ) which indicate wether null is
accepted, plus two overrides, no parameters and a class parameter. The
null accepting behaviour is functionaly equivalent to haven just a
name plus a boolean parameter ( notReallyAny(boolean acceptNull) +
notReallyAny(boolean acceptNull, Class klass) ).

What makes me feel uncorfortable with the proposal is :
- Too many names, I think two suffice.
- Different names for similar methods, similar names for different
  null accepting behaviour.

Given this, I think:
- anyIncludingNul(), anyIncludingNul(Class), anyNotNull(),
  anyNotNul(Class) cover all cases, for jdk <8 & 8 ( although
  parameterless ones are not too useful in <8 ) ( your example would be
  served by when(x.method(anyIncludingNull(List.class)) ).
- names should be kept paired. You state opting in for nulls is good
  practice, I'll accept that without discussion. You say people should
  opt in to use them, I accept thas as a precondition. Writing
  anyIncludingNull is for me opting in.

But then, we want 'any()'. It's nice, sounds good, it is short, reads
good (any() in 8, I do not care, just need this to compile,
any(List.class) in 7, I do not care, but .Well, then writing 'any(' is
opting in to use nulls, so the class version should begin with 'any('
too. I have no problem with having the null accepting versions
'nonDefaultAcceptingNullsAnyMatcher', and the other one 'any', or
'isA', IDEs are really good at completing, and I can easily manage a
couple of names, but having any, anyAs, isA, isNullOrA, and notNull
horrifies me.

Well, that's all for today. I hope it clarifies my position.

Regards.
    Francisco Olarte.

Ok, I think that mostly makes sense, although I'm not clear exactly what the full API you're proposing is that fits the requirements here. Your last paragraph seems to contradict the four methods you've suggested just above.

I think you're still suggesting an `any()` method with actively different behaviour to an `any(X.class)` method though. Inconsistencies between those two are how we ended up here, because one does active type matching and the other doesn't, and you need different null matching behaviour too. In addition, you definitely need `any()` or it'll be confusing, so I don't think there's any way you can have an `any(X.class)` method that does actual matching.

Sounds like there is a route through though: what happens if we accept that Java 7 is on the way out, stick only to casts, and stop making the API confusing just to support now unsupported Java versions? That would give an API of:
- `any()` - matches anything
- `isA(X.class)` - matches things with X type, not nulls
- `isNullOrA(X.class)` - matches things with X type, or nulls

If you're using Java 8, all is good, simple and clear. If you're using Java 7 you have to cast `any()`, but `(MyClass) any()` is clearer about what it's doing than anything else we have here, actually shorter than `any(MyClass.class)` anyway, and good IDE's will automatically suggest the cast for you too, so pretty easy to find for newbies. Null behaviour is also clear here, and we're pushing people to be explicit about whether they match nulls in all arguments they care about.

How does that sound to everybody?

Hi Tim:

On Wed, Apr 8, 2015 at 8:38 PM, Tim Perry notifications@github.com wrote:

> Ok, I think that mostly makes sense, although I'm not clear exactly what the full API you're proposing is that fits the requirements here. Your last paragraph seems to contradict the four methods you've suggested just above.

Any of my paragraphs may seem contradictory, but I do not know how to
convey the info and do not know what the exact requirements are., but
anyway, lets go on.

> I think you're still suggesting an any() method with actively different behaviour to an any(X.class) method though.

In my full sugestion not exactly, I suggested any to be the same as
any(Object.class), ( declared parameter class really, but it could be
implemented this way ). It checks the passed thing is null or a
subclass of Object ( second check redundant, stated for completitude
).

> Inconsistencies between those two are how we ended up here, because one does active type matching and the other doesn't, and you need different null matching behaviour too. In addition, you definitely need any() or it'll be confusing, so I don't think there's any way you can have an any(X.class) method that does actual matching.
> 
> Sounds like there is a route through though: what happens if we accept that Java 7 is on the way out, stick only to casts, and stop making the API confusing just to support now unsupported Java versions? That would give an API of:
> any() - matches anything
> isA(X.class) - matches things with X type, not nulls
> isNullOrA(X.class) - matches things with X type, or nulls

I'm definitely in favour of sticking to casts, as they are a standard
language feature and should be clear.

Now, on your three proposed methods, you are forgetting one, which is
on another part of the current API, notNull() ( or it's cousing
notNull(Class), I do not know whic notNull is not declared generic
like any though, I think it SHOULD be for java 8 ).

You have 2 choices, 1.- accept nulls, 2.-check class, For 1 you need
either a boolean argument or different names, for 2 you need a Class
argument to check against. So, in your proposal you would have:
- accept nulls, do not check class:  any(), used as is in java 8,
  casted in 7 ( or for overload resolution in 8 ).
- accept nulls, check class: isNullOrA(Class)
- reject nulls, do not check class: notNull() ( same comments as any )
- reject nulls, check class: isA(Class)

Which is fine dandy for me ( the naming stuff is trivial to achieve
using a FranciscoOlarteAdditionalMatchers helper class )

Basically you can have a makeMatcher(boolean acceptNulls, Class klass
) and then any()==makeMatcher(true, Object.class),
isNullOrA(klass)=makeMatcher(true, klass),
notNull()=makeMatcher(false, Object.class),
isA(klass)=makeMatcher(false, klass).

> If you're using Java 8, all is good, simple and clear. If you're using Java 7 you have to cast any(), but (MyClass) any() is clearer about what it's doing than anything else we have here, actually shorter than any(MyClass.class) anyway, and good IDE's will automatically suggest the cast for you too, so pretty easy to find for newbies. Null behaviour is also clear here, and we're pushing people to be explicit about whether they match nulls in all arguments they care about.

I think the null / check behaviour is clearer if you group them
together somehow ( like I've done above ). As this gets rid of the
confusing (current) anyAs(Class). Also I think notNull(Class) must go,
as what is does is served by isA(class).

> How does that sound to everybody?

Fine for me.

---------------NOT A PROPOSAL----------------
Now, I'll explain what I proposed ( for NAMING along with some
motivations ). I think this discussion seems to prove it is not easily
understood, this is only for reference.

Note there are no functional changes with the proposal above, just
name reorganizations as I think current names are confusing ( and I
know they are for me, but this is my problem and I can solve it ).

0.- get rid of anyAs and notNull(class) ( served by isA and isNullOrA ).

1.- any() - keep as it is.
2.- isNullOrA(class): rename to any(class), as functionality is very
similar (any()==isNullOrA(DeclaredParameterClass.class))
3.- isA() - rename to anyNotNull ( it appears next to any() in methods
list, and makes the behavioural differences easy to spot. Also, if you
have a method any() and anyNotNull ( both being offered by
autocomplete ) is natural to assume that any==anyIncludingNull, which
is correct ).
4.- notNull() - rename to anyNotNull() ( to complete the matrix ).

Note: In my NAMING proposal naked any==acceptNulls, It could easily be
reversed ( any=>anyOrNull, anyNotNull=>any, it just sounds bad to me
that way ( maybe because I'm used to x(Object) and x(@NonNull Object)
and/or explicitly documenting when nulls are not allowed).

Extra things:
- anyObject() - seems to do the same thing as any, if so get rid of it
  if to avoid confusion, if not do the same as with anyString below.
- isNull(Class) - given it can be done with (Class)isNull(), get rid
  of it. No need for a class checking version on this.
- anyString: Confusing name with current behaviour, given any() accept
  nulls. Rename it to isAString and then, per rule 3 above, to
  anyNotNullString. THEN I would add an anyString, equal to
  isNullOrA(String.class) or any(String.class) per rule 2. Also,
  consider deleting it (note below)
- anyInt/anyChar/...: as with anyString, in nearly all aspects.
- anyMap/anyMapOf ( and it's friends anyList, anyCollection ): Similar
  to anyString, rename to anyNotNullMap, and then use the now free
  anyMap to build one accepting nulls.

for anyString/anyInt/..... I would consider having a basic matchers
class, with any/anyNotNull etc.., and a matchers derived class ( a la
AdditionalMatchers ) and relegate all aliases to that one, so the
javadoc for the basic matchers class concentrates on basic
functionality and the one for the aliases/forwarders just states the
equivalence ). In fact I would better put a class for just the basic
any\* matchers ( including just any(), any(Class), anyNotNull(),
anyNotNull(class) and isNull(class)), another one for
eq/startsWith/... another one for the anyString and friends. Static
imports make them easy to use in modern Java and the documentation
would be much easier to read (for me at least).

## Hope this explains my vision.

Regards.
   Francisco Olarte.

I apologize, I haven't read the entire thread. I'm still setting up my
family in CA and trying to manage prioriorities.

I think we have following use cases:
1. I don't care about the parameter
2. I care that it is not null
3. I care about the type (implies (2))

Solutions:

1) any(), perhaps kill anyObject(), needs explicit casting
2) no special API, kill isNotNull()/notNull() or just leave the
isNotNull()/notNull(), needs explicit casting
3) any(String.class) alias to isA(String.class) (or kill isA(...))

I think it is ok if only use case 3) offers API that avoids casting. E.g.
if the user wants to avoid casting he needs to specify the matcher better
(which I don't think is a problem).

Cheers!

On Thu, Apr 9, 2015 at 2:39 AM, Francisco Olarte notifications@github.com
wrote:

> Hi Tim:
> 
> On Wed, Apr 8, 2015 at 8:38 PM, Tim Perry notifications@github.com
> wrote:
> 
> > Ok, I think that mostly makes sense, although I'm not clear exactly what
> > the full API you're proposing is that fits the requirements here. Your last
> > paragraph seems to contradict the four methods you've suggested just above.
> 
> Any of my paragraphs may seem contradictory, but I do not know how to
> convey the info and do not know what the exact requirements are., but
> anyway, lets go on.
> 
> > I think you're still suggesting an any() method with actively different
> > behaviour to an any(X.class) method though.
> 
> In my full sugestion not exactly, I suggested any to be the same as
> any(Object.class), ( declared parameter class really, but it could be
> implemented this way ). It checks the passed thing is null or a
> subclass of Object ( second check redundant, stated for completitude
> ).
> 
> > Inconsistencies between those two are how we ended up here, because one
> > does active type matching and the other doesn't, and you need different
> > null matching behaviour too. In addition, you definitely need any() or
> > it'll be confusing, so I don't think there's any way you can have an
> > any(X.class) method that does actual matching.
> > 
> > Sounds like there is a route through though: what happens if we accept
> > that Java 7 is on the way out, stick only to casts, and stop making the API
> > confusing just to support now unsupported Java versions? That would give an
> > API of:
> > any() - matches anything
> > isA(X.class) - matches things with X type, not nulls
> > isNullOrA(X.class) - matches things with X type, or nulls
> 
> I'm definitely in favour of sticking to casts, as they are a standard
> language feature and should be clear.
> 
> Now, on your three proposed methods, you are forgetting one, which is
> on another part of the current API, notNull() ( or it's cousing
> notNull(Class), I do not know whic notNull is not declared generic
> like any though, I think it SHOULD be for java 8 ).
> 
> You have 2 choices, 1.- accept nulls, 2.-check class, For 1 you need
> either a boolean argument or different names, for 2 you need a Class
> argument to check against. So, in your proposal you would have:
> - accept nulls, do not check class: any(), used as is in java 8,
>   casted in 7 ( or for overload resolution in 8 ).
> - accept nulls, check class: isNullOrA(Class)
> - reject nulls, do not check class: notNull() ( same comments as any )
> - reject nulls, check class: isA(Class)
> 
> Which is fine dandy for me ( the naming stuff is trivial to achieve
> using a FranciscoOlarteAdditionalMatchers helper class )
> 
> Basically you can have a makeMatcher(boolean acceptNulls, Class klass
> ) and then any()==makeMatcher(true, Object.class),
> isNullOrA(klass)=makeMatcher(true, klass),
> notNull()=makeMatcher(false, Object.class),
> isA(klass)=makeMatcher(false, klass).
> 
> > If you're using Java 8, all is good, simple and clear. If you're using
> > Java 7 you have to cast any(), but (MyClass) any() is clearer about what
> > it's doing than anything else we have here, actually shorter than
> > any(MyClass.class) anyway, and good IDE's will automatically suggest the
> > cast for you too, so pretty easy to find for newbies. Null behaviour is
> > also clear here, and we're pushing people to be explicit about whether they
> > match nulls in all arguments they care about.
> 
> I think the null / check behaviour is clearer if you group them
> together somehow ( like I've done above ). As this gets rid of the
> confusing (current) anyAs(Class). Also I think notNull(Class) must go,
> as what is does is served by isA(class).
> 
> > How does that sound to everybody?
> 
> Fine for me.
> 
> ---------------NOT A PROPOSAL----------------
> Now, I'll explain what I proposed ( for NAMING along with some
> motivations ). I think this discussion seems to prove it is not easily
> understood, this is only for reference.
> 
> Note there are no functional changes with the proposal above, just
> name reorganizations as I think current names are confusing ( and I
> know they are for me, but this is my problem and I can solve it ).
> 
> 0.- get rid of anyAs and notNull(class) ( served by isA and isNullOrA ).
> 
> 1.- any() - keep as it is.
> 2.- isNullOrA(class): rename to any(class), as functionality is very
> similar (any()==isNullOrA(DeclaredParameterClass.class))
> 3.- isA() - rename to anyNotNull ( it appears next to any() in methods
> list, and makes the behavioural differences easy to spot. Also, if you
> have a method any() and anyNotNull ( both being offered by
> autocomplete ) is natural to assume that any==anyIncludingNull, which
> is correct ).
> 4.- notNull() - rename to anyNotNull() ( to complete the matrix ).
> 
> Note: In my NAMING proposal naked any==acceptNulls, It could easily be
> reversed ( any=>anyOrNull, anyNotNull=>any, it just sounds bad to me
> that way ( maybe because I'm used to x(Object) and x(@NonNull Object)
> and/or explicitly documenting when nulls are not allowed).
> 
> Extra things:
> - anyObject() - seems to do the same thing as any, if so get rid of it
>   if to avoid confusion, if not do the same as with anyString below.
> - isNull(Class) - given it can be done with (Class)isNull(), get rid
>   of it. No need for a class checking version on this.
> - anyString: Confusing name with current behaviour, given any() accept
>   nulls. Rename it to isAString and then, per rule 3 above, to
>   anyNotNullString. THEN I would add an anyString, equal to
>   isNullOrA(String.class) or any(String.class) per rule 2. Also,
>   consider deleting it (note below)
> - anyInt/anyChar/...: as with anyString, in nearly all aspects.
> - anyMap/anyMapOf ( and it's friends anyList, anyCollection ): Similar
>   to anyString, rename to anyNotNullMap, and then use the now free
>   anyMap to build one accepting nulls.
> 
> for anyString/anyInt/..... I would consider having a basic matchers
> class, with any/anyNotNull etc.., and a matchers derived class ( a la
> AdditionalMatchers ) and relegate all aliases to that one, so the
> javadoc for the basic matchers class concentrates on basic
> functionality and the one for the aliases/forwarders just states the
> equivalence ). In fact I would better put a class for just the basic
> any\* matchers ( including just any(), any(Class), anyNotNull(),
> anyNotNull(class) and isNull(class)), another one for
> eq/startsWith/... another one for the anyString and friends. Static
> imports make them easy to use in modern Java and the documentation
> would be much easier to read (for me at least).
> 
> ## Hope this explains my vision.
> 
> Regards.
> Francisco Olarte.
> 
> ## 
> 
> Reply to this email directly or view it on GitHub
> https://github.com/mockito/mockito/issues/194#issuecomment-91175598.

## 

Szczepan Faber
Founder mockito.org; Core dev gradle.org
tweets as @szczepiq; blogs at blog.mockito.org

Hi Szczepan:

mmmm, delicious top posting...., anyway:

On Thu, Apr 9, 2015 at 3:59 PM, Szczepan Faber notifications@github.com wrote:

> I think we have following use cases:
> 1. I don't care about the parameter
> 2. I care that it is not null
> 3. I care about the type (implies (2))

I think you lack at least one ( 4.- I care it is null, but it is
already served by IsNull() ( or a casted null IIRC ) ,not discussed ).

> Solutions:
> 1) any(), perhaps kill anyObject(), needs explicit casting
> 2) no special API, kill isNotNull()/notNull() or just leave the
> isNotNull()/notNull(), needs explicit casting
> 3) any(String.class) alias to isA(String.class) (or kill isA(...))
> 
> I think it is ok if only use case 3) offers API that avoids casting. E.g.
> if the user wants to avoid casting he needs to specify the matcher better
> (which I don't think is a problem).

I don't think casting, specially in such a specialized case as
mockiing in tests, is an issue. And J8 will avoid most of it. What I
dislike of this is having mock.m((String)any()) accept nulls and
mock.m(any(String.class)) reject nulls. isA sounds/reads fine to me. I
prefer anyNotNull as name for 2 and 3 as it reads better, highlights
the relation with any ( they are the family of matchers which just
checks type, not value ), but I've reached a point where I think the
only form to expose a proposal is to implement it to expose how it
looks, which will have to wait in my case.

Also, thinking about the previous stuff, I'm beginnging to think
IsNullOrA(Class), although it has a clear definition ( I have a
mock.m(List), I want to match anything assignable to an ArrayList,
which are null or ArrayList subclasses, so mock.m(any(ArrayList)) ),
I'm not too sure about it's usefulness ( as I can do it with two
matchers, and isNull plus an isA with the same target, or use
AdditionalMatchers.or )

Francisco Olarte.

I agree with Francisco, if we're going for casts I don't think we can have `any(String.class)` still exist, because we can't make it usefully be consistent with `any()`. I think just `isA` works fine for that case though, and I find it quite readable and clear.

I do marginally prefer `notNull()` to `anyNotNull()`, just because it's shorter and simpler. I think `when(o.method(notNull(), notNull()))...` reads easier than `when(o.method(anyNotNull(), anyNotNull()))...`, and while anyNotNull makes sense in relation to any it's less clear what it does when you see it standalone. 'notNull' however is very clear indeed. It also doesn't feel quite so much like `any` and `notNull` are the same family as much as `isA/isNullOrA` are, just because `any` is kind of a special case (any + specific values are all people will probably use 1/2 the time, I expect).

I also do think `isNullOrA(X.class)` does need to exist explicitly too, just because it's a common case and having to write `or(isNull(), isA(String.class))` (or `or((String) isNull(), isA(String.class))` for Java 7) everywhere is quite substantially messier and harder to parse. Internally just being an alias to that is fine though.

Definitely feels like we're getting pretty close now! One more API update then:
- `any()` - matches anything, including nulls
- `notNull()` matches anything, except nulls
- `isA(X.class)` matches things of X type, except nulls
- `isNullOrA(X.class)` matches things of X type, including nulls
- We get rid of every other variant (`anyString()`, `isNotNull()`, etc)

I think there are some other extra variants we will still need for things like generic list type checks and varargs, but those should follow on fairly cleanly from these. Thoughts?

Hi Time:

On Thu, Apr 9, 2015 at 6:34 PM, Tim Perry notifications@github.com wrote:

> I agree with Francisco, if we're going for casts I don't think we can have any(String.class) still exist, because we can't make it usefully be consistent with any(). I think just isA works fine for that case though, and I find it quite readable and clear.

OK.

> I do marginally prefer notNull() to anyNotNull(), just because it's shorter and simpler. I think when(o.method(notNull(), notNull()))... reads easier than when(o.method(anyNotNull(), anyNotNull()))..., and while anyNotNull makes sense in relation to any it's less clear what it does when you see it standalone. 'notNull' however is very clear indeed.

OK. I donot agree with the arguments but I feel voting for notNull now
is much better than following the thread. I retract all my proposals
for anyNotNull.

--- ASIDE---

> It also doesn't feel quite so much like any and notNull are the same family as much as isA/isNullOrA are, just because any is kind of a special case (any + specific values are all people will probably use 1/2 the time, I expect).
> I think if you place them in a square, it does. isA is NW, isNullOrA
> is NE, any is SE, ¿ Which one goes into SW ? ( reminds me of the test
> I did in school ).

Also, any() is like isNullOrA(Object.class), notNull() is like
isA(Object.class).

NOT A PROPOSAL/DISCUSSION on the main issue, just put here as an
explanation of my abandoned views.
--- /ASIDE ---

> I also do think isNullOrA(X.class) does need to exist explicitly too, just because it's a common case and having to write or(isNull(), isA(String.class)) (or or((String) isNull(), isA(String.class)) for Java 7) everywhere is quite substantially messier and harder to parse. Internally just being an alias to that is fine though.

OK with it.

> Definitely feels like we're getting pretty close now! One more API update then:
> 
> any() - matches anything, including nulls
> notNull() matches anything, except nulls
> isA(X.class) matches things of X type, except nulls
> isNullOrA(X.class) matches things of X type, including nulls
> We get rid of every other variant (anyString(), isNotNull(), etc)
> 
> I think there are some other extra variants we will still need for things like generic list type checks and varargs, but those should follow on fairly cleanly from these. Thoughts?

Ok. My main problem is I find current naming extremely confussing.
Once anyAs is gone and replaced with ( more correct IMO )  isNullOrA
it nearly vanishes, but if variants are recovered/kept ( I would do it
in a separate class, which could be very easily documented at the top
and methods, otherwise they clutter the main matchers docs. Classed
are cheap, specially in test code ) keep their name coherent to the
implementation. I.e., givien anyString() can (should?) be implemented
as isA(String.class) to achieve current behaviour, name it isAString()
(same goes if behaviour is simillar to isNullOrA) ( or zap it, I
prefer just a longer way to do a thing than a confusing alternative )
( I used to try to put short names to things, but since about 20 years
ago I've been progresively going to longer and clearer, typing is
easier than thinking, YMMV ).

Francisco Olarte.

Cool, I think we're in agreement then. I'm very happy to zap lots of the extra methods like `anyString()` where Java 8 means they're not going to be useful and there's a simple easy to find alternative to them (like just casting `any()`, which most ide's will even suggest and do for you).

@bric3 @szczepiq Are you two happy if I open a PR extending my previous changes to implement this API, as in my message above?

Hi @pimterry @folarte 

Thanks for the discussion, I was also away staffed at Devoxx fr for the past week. I think there's some agreement here, I'm basically OK for these changes : 
- `<T> T any()` - matches anything, including nulls
- `<T> T notNull()` matches anything, except nulls
- `<T> T isA(Class<T> clazz)` matches things of `T` type but `null`
  => naming could be tweaked without the `is`, thus becoming `a(X.class)`, I understand this one is kinda bold.
- `<T> T isNullOrA(Class<T> clazz)` matches things of `T` type including `null`
  => naming could be tweaked without the `is`, thus becoming `nullOrA(X.class)`
- We get rid of every other variant (`anyString()`, `isNotNull(Class)`, etc)
  => there's still need for primitive matchers : `anyInt` should stay in my opinion, but this raises another issue with primitive wrappers, should they allow null, in my opinion they should not.

@szczepiq Another related task would be to deprecate APIs in the 1.x line.

Happy to drop the `is` prefix, seems shorter and clearer. This might be one place where we do want an alias, for `a(String.class)` and `an(Element.class)`, as otherwise I think it's quite difficult to read.

> - We get rid of every other variant (anyString(), isNotNull(Class), etc)
> 
> => there's still need for primitive matchers : anyInt should stay in my opinion, but this raises another issue with primitive wrappers, should they allow null, in my opinion they should not.

Do mean `anyInt()`, or `anInt()`? I think the conclusion of the above discussion is that we can't have an `anyInt()` method without breaking the API: either `anyInt()` actively matches the type and rejects null (confusingly inconsistent with `any()`), or it doesn't and it's confusing and people use it wrong (the current state of affairs).

For Java 8 `any()` should work everywhere I think, and for Java 7 you can use `(int) any()`. I can't easily test this right now; is there something about primitives, generics and our implementation that means this doesn't work? That's going to be a difficult problem to solve if so.

For `anInt()` on the other hand, it doesn't actually make the API inconsistent if we do add that as another method, so that's very doable. Not clear why we need it in this case either though.

Do you have an example that doesn't work with this as given?

Hi Brice:

On Sun, Apr 12, 2015 at 7:55 PM, Brice Dutheil notifications@github.com wrote:

> Thanks for the discussion, I was also away staffed at Devoxx fr for the past week. I think there's some agreement here, I'm basically OK for these changes :
> 
> <T> T any() - matches anything, including nulls
> <T> T notNull() matches anything, except nulls
> 
> <T> T isA(Class<T> clazz) matches things of T type but null
> => naming could be tweaked without the is, thus becoming a(X.class), I understand this one is kinda bold.

I strongly disagree with naming it a or ( sorry Tim ) an. I feel they
are too short and error prone ( and this is not COBOL, a PL/DSL is not
English ).

> <T> T isNullOrA(Class<T> clazz) matches things of T type including null
> => naming could be tweaked without the is, thus becoming nullOrA(X.class)

I stil think my any/anyNotNull overrrides where superior names, but as
this is functionally equivalent I'll just wrap it. OK so far.

> We get rid of every other variant (anyString(), isNotNull(Class), etc)
> => there's still need for primitive matchers : anyInt should stay in my opinion, but this raises another issue with primitive wrappers, should they allow null, in my opinion they should not.

I think the point of allowing nulls for primitives is a no point. If I
have a method mock.method(int) which I match with
when(mock.method(anyInt())) it doesn't matter that the matcher
receives an Integer due to boxing/reflection stuff, it will never be
null, becuase if I do "Integer integer = null;  mock.method(integer)"
autounboxing will raise NPE before matchers get anything to say. And
if there was another override mock.method(Integer), well, first this
should have been matched by an appropiately casted any/is\* and second,
it's so perverse that user deserves whatever happens there.

Francisco Olarte.

Soon. It's next in my queue :) Thank you guys for patience.

Great discussion. Thanks everybody for chipping in. Let's get this sorted out.

> What I
> dislike of this is having mock.m((String)any()) accept nulls and
> mock.m(any(String.class)) reject nulls.

I agree. There is a gotcha: given that any(SomeType.class) is most used matcher method, it will be a pain to users to upgrade to Mockito 2.0.

However, if we tell users that any(String.class) checks type but (String) any() does not it is rather awkward message and it might confusing down the road.

By now, most users are probably used to the behavior of Mockito matchers and the pitfall is well documented ;) So there is an option to leave things as they are.

Removing any(T) pretty much means that we need to remove all matcher methods like anyString() anyList(), etc. This increases the impact on the user.

I'll think about this a bit more and get back by the end of today.

BTW. what do you guys think about #246?

I think we're down to following options. Please vote or suggest other options:
1. Shoot down any(T) and anyT() in favor of isA(). This thread seems to be converging on this approach. Consistent and clean. High impact, potential churn.
2. Change any(T) and anyT() methods to reject nulls. Suggested by the community originally, potentially confusing down the road due to inconsistence with any(). This inconsistence becomes less of a problem with java8.
3. Do (2) but also shoot down any() replacing it with anyObject() or anything() or '_' (ala spock ;). Not sure I like killing any() because it is neatly compact.
4. Leave things as they are for now. Perhaps revisit for java8 support.

Hi
​ ​
Szczepan:

> BTW. what do you guys think about #246
> https://github.com/mockito/mockito/issues/246?
> 
> ​I think it may have some problems, and be an overload abuse​. If done this
> way I would vote for having long named methods with is() being just a
> forwarder. And I think there may be some ambiguities if overloaded is() is
> used to test overloaded method ( i.e., when you mock m(is(String.class))
> are you mocking m(Class c) ( as m(eq(String.class))  )  or m(String s) with
> any string? ( It's a contrived overload, but I've seem some of these where
> the String version takes a class name, I think OSGi has some of them ).
> Having a long method (anyIstanceOf, equalTo, evenm, specially, isNull()
> which I personally prefer to is(null) ( Which overload is it going to pick,
> the Object one with a null param ) ) lets people key a little more in the
> difficult cases and does not at too many complexity or a signigicant run
> time for test code ( is() is just a one line forwarder, and it's javedoc
> can be left as such which just an @link to the unoverloaded method ).

Regarding readability, I'm not sure compact overloaded names are more
readable, they may be easier to read aloud, but you need to invoke higher
level brain functions to parse it and distinguish the overload being used,
but maybe I'm just becoming slower.

​Francisco Olarte.​

Yep, I prefer option 1.

#246 sounds like a good idea to me, but we should definitely market it very clearly as a convenience method (as Francisco mentions), and obviously keep the explicit methods, so people are aware they can opt in to explicitly choosing the relevant option if they need to or they're not sure what the overloading does.

The overload I'm most suspicious of is `is(T)`, just because it's most likely to be ambiguous, in practice and when trying to just think about what a line is doing. `is(null)` seems clear, `is(stringStartingWithHello)` is fine, but if I saw`when(is(100), is(String.class))`, I think my default would be to assume that the argument needed to literally be the class object. Not totally sure about that though, happy to go with it if others are happy.

Any progress on this? Are people happy for me to put together a potential PR for option 1, which it sounds like we've settled on, as something concrete to discuss?

My preference is to have the following matchers (option 1?):
-  `<T> T any()`  that accepts anything including `null`.  I associate _"any"_ to the _"anything"_ in my world that includes null-values and instances. It is compact and suitable for the most common cases.
- `<T> T anyObject()` or `<T> T notNull()` reject `null` values opposite to any(). The name should indicate that null is rejected to avoid confusion about its behaviour.
- `<T> T isA(Class<? extends T>)` reject `null` values and all values that are not a subtype of `T`, like instanceof.
- all `any*()` and `any(T)` should be dropped cause they have different behaviour (as described before)

> 1. Shoot down any(T) and anyT() in favor of isA(). This thread seems to be converging on this approach. Consistent and clean. High impact, potential churn.
> 2. Change any(T) and anyT() methods to reject nulls. Suggested by the community originally, potentially confusing down the road due to inconsistence with any(). This inconsistence becomes less of a problem with java8.
> 3. Do (2) but also shoot down any() replacing it with anyObject() or anything() or '_' (ala spock ;). Not sure I like killing any() because it is neatly compact.
> 4. Leave things as they are for now. Perhaps revisit for java8 support.

Let's try to be decisive :)

Tim & Christian vote for option 1) I very much appreciate those votes and option 1 does have a lot of charm :)

Myself, I vote for 2) because:
- any(T) reads better (seems more fluent), is more intuitive to write than isA(). It looks good in tests.
- it is consistent gramatically with any(), it makes the API a bit more consistent
- java8 is very popular, people use any() for matching anything and can use any(T) for matching specific type (not null)
- removing any(T) (options 1 and 3) seems like a churn and big impact on users without strong enough justification. It seems arbitrary that we remove the any(T) methods. E.g. myself as a user, I would not be convinced that migrating to Mockito 2.0 is a good idea because I need to fix hundreds of compilation errors due to removal fundamental API method (anyT/any(T)). Even if I make that search&replace, I'm not convinced that tests look better now. The change also hurts muscle memory and users would be finding themselves using any(T) methods, finding the code not compile, then realizing that aha! this method was removed. However, if we update the behavior of any() (option 2) we will provide very nice signal to users during the migration to 2.0. We could potentially expose bugs. Most users expect nulls to be rejected by any(T) - Mockito 2.0 will make expose tests that fail that assumption.

We don't have to agree. However, it would really cool if we were on the same page :) It would be so nice if everyone of us could stand behind decisions we make as a team.

We definitely need to make the decision!!! (if left undecided, we're effectively deciding on option 4).

I would like to suggest introducing the isA API alongside any. The latter would accept nulls while the former would rejecet them.

Nulls are pretty common as values so we ahould not make this more difficult than necessary. Also, tgis makes migration easier.

I already started the work on this a few days ago, and I chose to kinda follow option 2 as well, here's the plan :
- `<T> T any()` that accepts anything including `null`. I am pondering the addition of `anything` as it is the original meaning of `any`.
- `* any*()` / `<T> any(T)` will be aliases of `<T> isA(T)`, **this is the expected behaviour by users**, doing this will introduce the rejection of `null`, with Java 8 I saw young developer to switching to `any()` when `null` values where used instead of `anyInt`.

Since we want to do a release candidate I suggest that we ship the _null safe_ `any*`, and remove the `null` check if too much people complain.

cc @TimvdLippe @marcingrzejszczak @raphw @szpak 

Thanks for feedback!

+1 to your plan.

-1 to 'anything', it feels that it does not add sufficient value. It's a
longer alias - not sure why would someone want to use it.

On Mon, Jul 25, 2016 at 10:10 AM Brice Dutheil notifications@github.com
wrote:

> I already started the work on this a few days ago, and I chose to kinda
> follow option 2 as well, here's the plan :
> - <T> T any() that accepts anything including null. I am pondering the
>   addition of anything as it is the original meaning of any.
> - \* any_() / <T> any(T) will be aliases of <T> isA(T), *this is the
>   expected behaviour by users_, doing this will introduce the rejection
>   of null, with Java 8 I saw young developer to switching to any() when
>   null values where used instead of anyInt.
> 
> Since we want to do a release candidate I suggest that we ship the _null
> safe_ any*, and remove the null check if too much people complain.
> 
> cc @TimvdLippe https://github.com/TimvdLippe @marcingrzejszczak
> https://github.com/marcingrzejszczak @raphw https://github.com/raphw
> @szpak https://github.com/szpak
> 
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> https://github.com/mockito/mockito/issues/194#issuecomment-235017691,
> or mute the thread
> https://github.com/notifications/unsubscribe-auth/AABgp-nrLrlhKpwIt9XZjvOvBWLNnglBks5qZO3wgaJpZM4D6d0z
> .

+1 i agree, lets try this for the RC.


Pull request review comments:

Patch that resolved the issue:
diff --git a/src/main/java/org/mockito/ArgumentMatchers.java b/src/main/java/org/mockito/ArgumentMatchers.java
index 8c56882540..51a3bf4993 100644
--- a/src/main/java/org/mockito/ArgumentMatchers.java
+++ b/src/main/java/org/mockito/ArgumentMatchers.java
@@ -13,10 +13,10 @@
 import org.mockito.internal.matchers.apachecommons.ReflectionEquals;
 import org.mockito.internal.util.Primitives;
 
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -26,379 +26,744 @@
 
 /**
  * Allow flexible verification or stubbing. See also {@link AdditionalMatchers}.
+ *
  * <p>
  * {@link Mockito} extends ArgumentMatchers so to get access to all matchers just import Mockito class statically.
+ *
  * <pre class="code"><code class="java">
  * //stubbing using anyInt() argument matcher
  * when(mockedList.get(anyInt())).thenReturn("element");
- * <p>
+ *
  * //following prints "element"
  * System.out.println(mockedList.get(999));
- * <p>
+ *
  * //you can also verify using argument matcher
  * verify(mockedList).get(anyInt());
  * </code></pre>
- * Scroll down to see all methods - full list of matchers.
+ *
  * <p>
- * <b>Warning:</b>
+ * Since Mockito <code>any(Class)</code> and <code>anyInt</code> family matchers perform a type check, thus they won't
+ * match <code>null</code> arguments. Instead use the <code>isNull</code> matcher.
+ *
+ * <pre class="code"><code class="java">
+ * // stubbing using anyBoolean() argument matcher
+ * when(mock.dryRun(anyBoolean())).thenReturn("state");
+ *
+ * // below the stub won't match, and won't return "state"
+ * mock.dryRun(null);
+ *
+ * // either change the stub
+ * when(mock.dryRun(isNull())).thenReturn("state");
+ * mock.dryRun(null); // ok
+ *
+ * // or fix the code ;)
+ * when(mock.dryRun(anyBoolean())).thenReturn("state");
+ * mock.dryRun(true); // ok
+ *
+ * </code></pre>
+ *
+ * The same apply for verification.
+ * </p>
+ *
+ *
+ * Scroll down to see all methods - full list of matchers.
+ *
  * <p>
+ * <b>Warning:</b><br/>
+ *
  * If you are using argument matchers, <b>all arguments</b> have to be provided by matchers.
- * <p>
+ *
  * E.g: (example shows verification but the same applies to stubbing):
+ * </p>
+ *
  * <pre class="code"><code class="java">
  * verify(mock).someMethod(anyInt(), anyString(), <b>eq("third argument")</b>);
  * //above is correct - eq() is also an argument matcher
- * <p>
+ *
  * verify(mock).someMethod(anyInt(), anyString(), <b>"third argument"</b>);
  * //above is incorrect - exception will be thrown because third argument is given without argument matcher.
  * </code></pre>
+ *
  * <p>
  * Matcher methods like <code>anyObject()</code>, <code>eq()</code> <b>do not</b> return matchers.
  * Internally, they record a matcher on a stack and return a dummy value (usually null).
  * This implementation is due static type safety imposed by java compiler.
  * The consequence is that you cannot use <code>anyObject()</code>, <code>eq()</code> methods outside of verified/stubbed method.
- * <p>
+ * </p>
+ *
  * <h1>Custom Argument ArgumentMatchers</h1>
  * <p>
  * It is important to understand the use cases and available options for dealing with non-trivial arguments
  * <b>before</b> implementing custom argument matchers. This way, you can select the best possible approach
  * for given scenario and produce highest quality test (clean and maintainable).
  * Please read on in the javadoc for {@link ArgumentMatcher} to learn about approaches and see the examples.
+ * </p>
  */
 @SuppressWarnings("unchecked")
 public class ArgumentMatchers {
 
     /**
-     * Any <code>boolean</code> or non-null <code>Boolean</code>
+     * Matches <strong>anything</strong>, including nulls and varargs.
+     *
      * <p>
      * See examples in javadoc for {@link ArgumentMatchers} class
      *
-     * @return <code>false</code>.
+     * This is an alias of: {@link #anyObject()} and {@link #any(java.lang.Class)}
+     * </p>
+     *
+     * <p>
+     * <strong>Notes : </strong><br/>
+     * <ul>
+     *     <li>For primitive types use {@link #anyChar()} family or {@link #isA(Class)} or {@link #any(Class)}.</li>
+     *     <li>Since mockito 2.0 {@link #any(Class)} is not anymore an alias of this method.</li>
+     * </ul>
+     * </p>
+     *
+     * @return <code>null</code>.
+     *
+     * @see #any(Class)
+     * @see #anyObject()
+     * @see #anyVararg()
+     * @see #anyChar()
+     * @see #anyInt()
+     * @see #anyBoolean()
+     * @see #anyCollectionOf(Class)
      */
-    public static boolean anyBoolean() {
-        reportMatcher(new InstanceOf(Boolean.class));
-        return false;
+    public static <T> T any() {
+        return anyObject();
     }
 
     /**
-     * Any <code>byte</code> or non-null <code>Byte</code>.
+     * Matches anything, including <code>null</code>.
+     *
      * <p>
-     * See examples in javadoc for {@link ArgumentMatchers} class
+     * This is an alias of: {@link #any()} and {@link #any(java.lang.Class)}.
+     * See examples in javadoc for {@link ArgumentMatchers} class.
+     * </p>
      *
-     * @return <code>0</code>.
+     * @return <code>null</code>.
+     * @see #any()
+     * @see #any(Class)
+     * @see #notNull()
+     * @see #notNull(Class)
+     * @deprecated This will be removed in Mockito 3.0 (which will be java 8 only)
      */
-    public static byte anyByte() {
-        reportMatcher(new InstanceOf(Byte.class));
-        return 0;
+    @Deprecated
+    public static <T> T anyObject() {
+        reportMatcher(Any.ANY);
+        return null;
     }
 
     /**
-     * Any <code>char</code> or non-null <code>Character</code>.
+     * Matches any object of given type, excluding nulls.
+     *
      * <p>
-     * See examples in javadoc for {@link ArgumentMatchers} class
+     * This matcher will perform a type check with the given type, thus excluding values.
+     * See examples in javadoc for {@link ArgumentMatchers} class.
      *
-     * @return <code>0</code>.
+     * This is an alias of: {@link #isA(Class)}}
+     * </p>
+     *
+     * <p>
+     * Since Mockito 2.0, only allow non-null instance of <code></code>, thus <code>null</code> is not anymore a valid value.
+     * As reference are nullable, the suggested API to <strong>match</strong> <code>null</code>
+     * would be {@link #isNull()}. We felt this change would make tests harness much safer that it was with Mockito
+     * 1.x.
+     * </p>
+     *
+     * <p><strong>Notes : </strong><br/>
+     * <ul>
+     *     <li>For primitive types use {@link #anyChar()} family.</li>
+     *     <li>Since Mockito 2.0 this method will perform a type check thus <code>null</code> values are not authorized.</li>
+     *     <li>Since mockito 2.0 {@link #any()} and {@link #anyObject()} are not anymore aliases of this method.</li>
+     * </ul>
+     * </p>
+     *
+     * @param <T> The accepted type
+     * @param type the class of the accepted type.
+     * @return <code>null</code>.
+     * @see #any()
+     * @see #anyObject()
+     * @see #anyVararg()
+     * @see #isA(Class)
+     * @see #notNull()
+     * @see #notNull(Class)
+     * @see #isNull()
+     * @see #isNull(Class)
      */
-    public static char anyChar() {
-        reportMatcher(new InstanceOf(Character.class));
-        return 0;
+    public static <T> T any(Class<T> type) {
+        reportMatcher(new InstanceOf.VarArgAware(type, "<any " + type.getCanonicalName() + ">"));
+        return defaultValue(type);
     }
 
     /**
-     * Any int or non-null Integer.
+     * <code>Object</code> argument that implements the given class.
      * <p>
      * See examples in javadoc for {@link ArgumentMatchers} class
      *
-     * @return <code>0</code>.
+     * @param <T>  the accepted type.
+     * @param type the class of the accepted type.
+     * @return <code>null</code>.
+     * @see #any(Class)
      */
-    public static int anyInt() {
-        reportMatcher(new InstanceOf(Integer.class));
-        return 0;
+    public static <T> T isA(Class<T> type) {
+        reportMatcher(new InstanceOf(type));
+        return defaultValue(type);
     }
 
     /**
-     * Any <code>long</code> or non-null <code>Long</code>.
+     * Any vararg, meaning any number and values of arguments.
+     *
      * <p>
-     * See examples in javadoc for {@link ArgumentMatchers} class
+     * Example:
+     * <pre class="code"><code class="java">
+     * //verification:
+     * mock.foo(1, 2);
+     * mock.foo(1, 2, 3, 4);
      *
-     * @return <code>0</code>.
+     * verify(mock, times(2)).foo(anyVararg());
+     *
+     * //stubbing:
+     * when(mock.foo(anyVararg()).thenReturn(100);
+     *
+     * //prints 100
+     * System.out.println(mock.foo(1, 2));
+     * //also prints 100
+     * System.out.println(mock.foo(1, 2, 3, 4));
+     * </code></pre>
+     * </p>
+     *
+     * <p>
+     * See examples in javadoc for {@link ArgumentMatchers} class.
+     * </p>
+     *
+     * @return <code>null</code>.
+     * @see #any()
+     * @see #any(Class)
+     * @deprecated as of 2.0 use {@link #any()}
      */
-    public static long anyLong() {
-        reportMatcher(new InstanceOf(Long.class));
-        return 0;
+    @Deprecated
+    public static <T> T anyVararg() {
+        any();
+        return null;
     }
 
     /**
-     * Any <code>float</code> or non-null <code>Float</code>.
+     * Any <code>boolean</code> or <strong>non-null</strong> <code>Boolean</code>
+     *
      * <p>
-     * See examples in javadoc for {@link ArgumentMatchers} class
+     * Since Mockito 2.0, only allow valued <code>Boolean</code>, thus <code>null</code> is not anymore a valid value.
+     * As primitive wrappers are nullable, the suggested API to <strong>match</strong> <code>null</code> wrapper
+     * would be {@link #isNull()}. We felt this change would make tests harness much safer that it was with Mockito
+     * 1.x.
+     * </p>
      *
-     * @return <code>0</code>.
+     * <p>
+     * See examples in javadoc for {@link ArgumentMatchers} class.
+     * </p>
+     *
+     * @return <code>false</code>.
+     * @see #isNull()
+     * @see #isNull(Class)
      */
-    public static float anyFloat() {
-        reportMatcher(new InstanceOf(Float.class));
-        return 0;
+    public static boolean anyBoolean() {
+        reportMatcher(new InstanceOf(Boolean.class, "<any boolean>"));
+        return false;
     }
 
     /**
-     * Any <code>double</code> or non-null <code>Double</code>.
+     * Any <code>byte</code> or <strong>non-null</strong> <code>Byte</code>.
+     *
      * <p>
-     * See examples in javadoc for {@link ArgumentMatchers} class
+     * Since Mockito 2.0, only allow valued <code>Byte</code>, thus <code>null</code> is not anymore a valid value.
+     * As primitive wrappers are nullable, the suggested API to <strong>match</strong> <code>null</code> wrapper
+     * would be {@link #isNull()}. We felt this change would make tests harness much safer that it was with Mockito
+     * 1.x.
+     * </p>
+     *
+     * <p>
+     * See examples in javadoc for {@link ArgumentMatchers} class.
+     * </p>
      *
      * @return <code>0</code>.
+     * @see #isNull()
+     * @see #isNull(Class)
      */
-    public static double anyDouble() {
-        reportMatcher(new InstanceOf(Double.class));
+    public static byte anyByte() {
+        reportMatcher(new InstanceOf(Byte.class, "<any byte>"));
         return 0;
     }
 
     /**
-     * Any <code>short</code> or non-null <code>Short</code>.
+     * Any <code>char</code> or <strong>non-null</strong> <code>Character</code>.
+     *
      * <p>
-     * See examples in javadoc for {@link ArgumentMatchers} class
+     * Since Mockito 2.0, only allow valued <code>Character</code>, thus <code>null</code> is not anymore a valid value.
+     * As primitive wrappers are nullable, the suggested API to <strong>match</strong> <code>null</code> wrapper
+     * would be {@link #isNull()}. We felt this change would make tests harness much safer that it was with Mockito
+     * 1.x.
+     * </p>
+     *
+     * <p>
+     * See examples in javadoc for {@link ArgumentMatchers} class.
+     * </p>
      *
      * @return <code>0</code>.
+     * @see #isNull()
+     * @see #isNull(Class)
      */
-    public static short anyShort() {
-        reportMatcher(new InstanceOf(Short.class));
+    public static char anyChar() {
+        reportMatcher(new InstanceOf(Character.class, "<any char>"));
         return 0;
     }
 
     /**
-     * Matches anything, including null.
+     * Any int or <strong>non-null</strong> <code>Integer</code>.
+     *
      * <p>
-     * This is an alias of: {@link #any()} and {@link #any(java.lang.Class)}
+     * Since Mockito 2.0, only allow valued <code>Integer</code>, thus <code>null</code> is not anymore a valid value.
+     * As primitive wrappers are nullable, the suggested API to <strong>match</strong> <code>null</code> wrapper
+     * would be {@link #isNull()}. We felt this change would make tests harness much safer that it was with Mockito
+     * 1.x.
+     * </p>
+     *
      * <p>
-     * See examples in javadoc for {@link ArgumentMatchers} class
+     * See examples in javadoc for {@link ArgumentMatchers} class.
+     * </p>
      *
-     * @return <code>null</code>.
+     * @return <code>0</code>.
+     * @see #isNull()
+     * @see #isNull(Class)
      */
-    public static <T> T anyObject() {
-        reportMatcher(Any.ANY);
-        return null;
+    public static int anyInt() {
+        reportMatcher(new InstanceOf(Integer.class, "<any integer>"));
+        return 0;
     }
 
     /**
-     * Any vararg, meaning any number and values of arguments.
-     * <p>
-     * Example:
-     * <pre class="code"><code class="java">
-     * //verification:
-     * mock.foo(1, 2);
-     * mock.foo(1, 2, 3, 4);
-     * <p>
-     * verify(mock, times(2)).foo(anyVararg());
+     * Any <code>long</code> or <strong>non-null</strong> <code>Long</code>.
+     *
      * <p>
-     * //stubbing:
-     * when(mock.foo(anyVararg()).thenReturn(100);
+     * Since Mockito 2.0, only allow valued <code>Long</code>, thus <code>null</code> is not anymore a valid value.
+     * As primitive wrappers are nullable, the suggested API to <strong>match</strong> <code>null</code> wrapper
+     * would be {@link #isNull()}. We felt this change would make tests harness much safer that it was with Mockito
+     * 1.x.
+     * </p>
+     *
      * <p>
-     * //prints 100
-     * System.out.println(mock.foo(1, 2));
-     * //also prints 100
-     * System.out.println(mock.foo(1, 2, 3, 4));
-     * </code></pre>
-     * See examples in javadoc for {@link ArgumentMatchers} class
+     * See examples in javadoc for {@link ArgumentMatchers} class.
+     * </p>
      *
-     * @return <code>null</code>.
-     * @deprecated as of 2.0 use {@link #any()}
+     * @return <code>0</code>.
+     * @see #isNull()
+     * @see #isNull(Class)
      */
-    @Deprecated
-    public static <T> T anyVararg() {
-        any();
-        return null;
+    public static long anyLong() {
+        reportMatcher(new InstanceOf(Long.class, "<any long>"));
+        return 0;
     }
 
     /**
-     * Matches any object, including nulls
-     * <p>
-     * This method doesn't do type checks with the given parameter, it is only there
-     * to avoid casting in your code. This might however change (type checks could
-     * be added) in a future major release.
-     * <p>
-     * See examples in javadoc for {@link ArgumentMatchers} class
+     * Any <code>float</code> or <strong>non-null</strong> <code>Float</code>.
+     *
      * <p>
-     * This is an alias of: {@link #any()} and {@link #anyObject()}
+     * Since Mockito 2.0, only allow valued <code>Float</code>, thus <code>null</code> is not anymore a valid value.
+     * As primitive wrappers are nullable, the suggested API to <strong>match</strong> <code>null</code> wrapper
+     * would be {@link #isNull()}. We felt this change would make tests harness much safer that it was with Mockito
+     * 1.x.
+     * </p>
+     *
      * <p>
+     * See examples in javadoc for {@link ArgumentMatchers} class.
+     * </p>
      *
-     * @return <code>null</code>.
+     * @return <code>0</code>.
+     * @see #isNull()
+     * @see #isNull(Class)
      */
-    public static <T> T any(Class<T> clazz) {
-        reportMatcher(Any.ANY);
-        return defaultValue(clazz);
+    public static float anyFloat() {
+        reportMatcher(new InstanceOf(Float.class, "<any float>"));
+        return 0;
     }
 
     /**
-     * Matches anything, including nulls and varargs
+     * Any <code>double</code> or <strong>non-null</strong> <code>Double</code>.
+     *
      * <p>
-     * Shorter alias to {@link ArgumentMatchers#anyObject()}
+     * Since Mockito 2.0, only allow valued <code>Double</code>, thus <code>null</code> is not anymore a valid value.
+     * As primitive wrappers are nullable, the suggested API to <strong>match</strong> <code>null</code> wrapper
+     * would be {@link #isNull()}. We felt this change would make tests harness much safer that it was with Mockito
+     * 1.x.
+     * </p>
+     *
      * <p>
-     * See examples in javadoc for {@link ArgumentMatchers} class
+     * See examples in javadoc for {@link ArgumentMatchers} class.
+     * </p>
+     *
+     * @return <code>0</code>.
+     * @see #isNull()
+     * @see #isNull(Class)
+     */
+    public static double anyDouble() {
+        reportMatcher(new InstanceOf(Double.class, "<any double>"));
+        return 0;
+    }
+
+    /**
+     * Any <code>short</code> or <strong>non-null</strong> <code>Short</code>.
+     *
      * <p>
-     * This is an alias of: {@link #anyObject()} and {@link #any(java.lang.Class)}
+     * Since Mockito 2.0, only allow valued <code>Short</code>, thus <code>null</code> is not anymore a valid value.
+     * As primitive wrappers are nullable, the suggested API to <strong>match</strong> <code>null</code> wrapper
+     * would be {@link #isNull()}. We felt this change would make tests harness much safer that it was with Mockito
+     * 1.x.
+     * </p>
+     *
      * <p>
+     * See examples in javadoc for {@link ArgumentMatchers} class.
+     * </p>
      *
-     * @return <code>null</code>.
+     * @return <code>0</code>.
+     * @see #isNull()
+     * @see #isNull(Class)
      */
-    public static <T> T any() {
-        return anyObject();
+    public static short anyShort() {
+        reportMatcher(new InstanceOf(Short.class, "<any short>"));
+        return 0;
     }
 
     /**
-     * Any non-null <code>String</code>
+     * Any <strong>non-null</strong> <code>String</code>
+     *
      * <p>
-     * See examples in javadoc for {@link ArgumentMatchers} class
+     * Since Mockito 2.0, only allow non-null <code>String</code>.
+     * As this is a nullable reference, the suggested API to <strong>match</strong> <code>null</code> wrapper
+     * would be {@link #isNull()}. We felt this change would make tests harness much safer that it was with Mockito
+     * 1.x.
+     * </p>
+     *
+     * <p>
+     * See examples in javadoc for {@link ArgumentMatchers} class.
+     * </p>
      *
      * @return empty String ("")
+     * @see #isNull()
+     * @see #isNull(Class)
      */
     public static String anyString() {
-        reportMatcher(new InstanceOf(String.class));
+        reportMatcher(new InstanceOf(String.class, "<any string>"));
         return "";
     }
 
     /**
-     * Any non-null <code>List</code>.
+     * Any <strong>non-null</strong> <code>List</code>.
+     *
      * <p>
-     * See examples in javadoc for {@link ArgumentMatchers} class
+     * Since Mockito 2.0, only allow non-null <code>List</code>.
+     * As this is a nullable reference, the suggested API to <strong>match</strong> <code>null</code> wrapper
+     * would be {@link #isNull()}. We felt this change would make tests harness much safer that it was with Mockito
+     * 1.x.
+     * </p>
+     *
+     * <p>
+     * See examples in javadoc for {@link ArgumentMatchers} class.
+     * </p>
      *
      * @return empty List.
+     * @see #anyListOf(Class)
+     * @see #isNull()
+     * @see #isNull(Class)
      */
     public static List anyList() {
-        reportMatcher(new InstanceOf(List.class));
-        return new LinkedList();
+        reportMatcher(new InstanceOf(List.class, "<any List>"));
+        return new ArrayList(0);
     }
 
     /**
-     * Generic friendly alias to {@link ArgumentMatchers#anyList()}.
-     * It's an alternative to &#064;SuppressWarnings("unchecked") to keep code clean of compiler warnings.
+     * Any <strong>non-null</strong> <code>List</code>.
+     *
+     * Generic friendly alias to {@link ArgumentMatchers#anyList()}. It's an alternative to
+     * <code>&#064;SuppressWarnings("unchecked")</code> to keep code clean of compiler warnings.
+     *
      * <p>
-     * Any non-null <code>List</code>.
+     * This method doesn't do type checks of the list content with the given type parameter, it is only there
+     * to avoid casting in the code.
+     * </p>
+     *
      * <p>
-     * This method doesn't do type checks with the given parameter, it is only there
-     * to avoid casting in your code. This might however change (type checks could
-     * be added) in a future major release.
+     * Since Mockito 2.0, only allow non-null <code>List</code>.
+     * As this is a nullable reference, the suggested API to <strong>match</strong> <code>null</code> wrapper
+     * would be {@link #isNull()}. We felt this change would make tests harness much safer that it was with Mockito
+     * 1.x.
+     * </p>
+     *
      * <p>
-     * See examples in javadoc for {@link ArgumentMatchers} class
+     * See examples in javadoc for {@link ArgumentMatchers} class.
+     * </p>
      *
      * @param clazz Type owned by the list to avoid casting
      * @return empty List.
+     * @see #anyList()
+     * @see #isNull()
+     * @see #isNull(Class)
+     * @deprecated With Java 8 this method will be removed in Mockito 3.0. This method is only used for generic
+     * friendliness to avoid casting, this is not anymore needed in Java 8.
      */
     public static <T> List<T> anyListOf(Class<T> clazz) {
         return anyList();
     }
 
     /**
-     * Any non-null <code>Set</code>.
+     * Any <strong>non-null</strong> <code>Set</code>.
+     *
      * <p>
-     * See examples in javadoc for {@link ArgumentMatchers} class
+     * Since Mockito 2.0, only allow non-null <code>Set</code>.
+     * As this is a nullable reference, the suggested API to <strong>match</strong> <code>null</code> wrapper
+     * would be {@link #isNull()}. We felt this change would make tests harness much safer that it was with Mockito
+     * 1.x.
+     * </p>
+     *
+     * <p>
+     * See examples in javadoc for {@link ArgumentMatchers} class.
+     * </p>
      *
      * @return empty Set
+     * @see #anySetOf(Class)
+     * @see #isNull()
+     * @see #isNull(Class)
      */
     public static Set anySet() {
-        reportMatcher(new InstanceOf(Set.class));
-        return new HashSet();
+        reportMatcher(new InstanceOf(Set.class, "<any set>"));
+        return new HashSet(0);
     }
 
     /**
+     * Any <strong>non-null</strong> <code>Set</code>.
+     *
+     * <p>
      * Generic friendly alias to {@link ArgumentMatchers#anySet()}.
-     * It's an alternative to &#064;SuppressWarnings("unchecked") to keep code clean of compiler warnings.
+     * It's an alternative to <code>&#064;SuppressWarnings("unchecked")</code> to keep code clean of compiler warnings.
+     * </p>
+     *
      * <p>
-     * Any non-null <code>Set</code>.
+     * This method doesn't do type checks of the set content with the given type parameter, it is only there
+     * to avoid casting in the code.
+     * </p>
+     *
      * <p>
-     * This method doesn't do type checks with the given parameter, it is only there
-     * to avoid casting in your code. This might however change (type checks could
-     * be added) in a future major release.
+     * Since Mockito 2.0, only allow non-null <code>Set</code>.
+     * As this is a nullable reference, the suggested API to <strong>match</strong> <code>null</code> wrapper
+     * would be {@link #isNull()}. We felt this change would make tests harness much safer that it was with Mockito
+     * 1.x.
+     * </p>
+     *
      * <p>
-     * See examples in javadoc for {@link ArgumentMatchers} class
+     * See examples in javadoc for {@link ArgumentMatchers} class.
+     * </p>
      *
      * @param clazz Type owned by the Set to avoid casting
      * @return empty Set
+     * @see #anySet()
+     * @see #isNull()
+     * @see #isNull(Class)
+     * @deprecated With Java 8 this method will be removed in Mockito 3.0. This method is only used for generic
+     * friendliness to avoid casting, this is not anymore needed in Java 8.
      */
     public static <T> Set<T> anySetOf(Class<T> clazz) {
         return anySet();
     }
 
     /**
-     * Any non-null <code>Map</code>.
+     * Any <strong>non-null</strong> <code>Map</code>.
+     *
      * <p>
-     * See examples in javadoc for {@link ArgumentMatchers} class
+     * Since Mockito 2.0, only allow non-null <code>Map</code>.
+     * As this is a nullable reference, the suggested API to <strong>match</strong> <code>null</code> wrapper
+     * would be {@link #isNull()}. We felt this change would make tests harness much safer that it was with Mockito
+     * 1.x.
+     * </p>
+     *
+     * <p>
+     * See examples in javadoc for {@link ArgumentMatchers} class.
+     * </p>
      *
      * @return empty Map.
+     * @see #anyMapOf(Class, Class)
+     * @see #isNull()
+     * @see #isNull(Class)
      */
     public static Map anyMap() {
-        reportMatcher(new InstanceOf(Map.class));
-        return new HashMap();
+        reportMatcher(new InstanceOf(Map.class, "<any map>"));
+        return new HashMap(0);
     }
 
     /**
+     * Any <strong>non-null</strong> <code>Map</code>.
+     *
+     * <p>
      * Generic friendly alias to {@link ArgumentMatchers#anyMap()}.
-     * It's an alternative to &#064;SuppressWarnings("unchecked") to keep code clean of compiler warnings.
+     * It's an alternative to <code>&#064;SuppressWarnings("unchecked")</code> to keep code clean of compiler warnings.
+     * </p>
+     *
      * <p>
-     * Any non-null <code>Map</code>.
+     * This method doesn't do type checks of the map content with the given type parameter, it is only there
+     * to avoid casting in the code.
+     * </p>
+     *
      * <p>
-     * This method doesn't do type checks with the given parameter, it is only there
-     * to avoid casting in your code. This might however change (type checks could
-     * be added) in a future major release.
+     * Since Mockito 2.0, only allow non-null <code>Map</code>.
+     * As this is a nullable reference, the suggested API to <strong>match</strong> <code>null</code> wrapper
+     * would be {@link #isNull()}. We felt this change would make tests harness much safer that it was with Mockito
+     * 1.x.
+     * </p>
+     *
      * <p>
-     * See examples in javadoc for {@link ArgumentMatchers} class
+     * See examples in javadoc for {@link ArgumentMatchers} class.
+     * </p>
      *
      * @param keyClazz   Type of the map key to avoid casting
      * @param valueClazz Type of the value to avoid casting
      * @return empty Map.
+     * @see #anyMap()
+     * @see #isNull()
+     * @see #isNull(Class)
+     * @deprecated With Java 8 this method will be removed in Mockito 3.0. This method is only used for generic
+     * friendliness to avoid casting, this is not anymore needed in Java 8.
      */
     public static <K, V> Map<K, V> anyMapOf(Class<K> keyClazz, Class<V> valueClazz) {
         return anyMap();
     }
 
     /**
-     * Any non-null <code>Collection</code>.
+     * Any <strong>non-null</strong> <code>Collection</code>.
+     *
      * <p>
-     * See examples in javadoc for {@link ArgumentMatchers} class
+     * Since Mockito 2.0, only allow non-null <code>Collection</code>.
+     * As this is a nullable reference, the suggested API to <strong>match</strong> <code>null</code>
+     * would be {@link #isNull()}. We felt this change would make tests harness much safer that it was with Mockito
+     * 1.x.
+     * </p>
+     *
+     * <p>
+     * See examples in javadoc for {@link ArgumentMatchers} class.
+     * </p>
      *
      * @return empty Collection.
+     * @see #anyCollectionOf(Class)
+     * @see #isNull()
+     * @see #isNull(Class)
      */
     public static Collection anyCollection() {
-        reportMatcher(new InstanceOf(Collection.class));
-        return new LinkedList();
+        reportMatcher(new InstanceOf(Collection.class, "<any collection>"));
+        return new ArrayList(0);
     }
 
     /**
+     * Any <strong>non-null</strong> <code>Collection</code>.
+     *
+     * <p>
      * Generic friendly alias to {@link ArgumentMatchers#anyCollection()}.
-     * It's an alternative to &#064;SuppressWarnings("unchecked") to keep code clean of compiler warnings.
+     * It's an alternative to <code>&#064;SuppressWarnings("unchecked")</code> to keep code clean of compiler warnings.
+     * </p>
+     *
      * <p>
-     * Any non-null <code>Collection</code>.
+     * This method doesn't do type checks of the collection content with the given type parameter, it is only there
+     * to avoid casting in the code.
+     * </p>
+     *
      * <p>
-     * This method doesn't do type checks with the given parameter, it is only there
-     * to avoid casting in your code. This might however change (type checks could
-     * be added) in a future major release.
+     * Since Mockito 2.0, only allow non-null <code>Collection</code>.
+     * As this is a nullable reference, the suggested API to <strong>match</strong> <code>null</code>
+     * would be {@link #isNull()}. We felt this change would make tests harness much safer that it was with Mockito
+     * 1.x.
+     * </p>
+     *
      * <p>
-     * See examples in javadoc for {@link ArgumentMatchers} class
+     * See examples in javadoc for {@link ArgumentMatchers} class.
+     * </p>
      *
      * @param clazz Type owned by the collection to avoid casting
      * @return empty Collection.
+     * @see #anyCollection()
+     * @see #isNull()
+     * @see #isNull(Class)
+     * @deprecated With Java 8 this method will be removed in Mockito 3.0. This method is only used for generic
+     * friendliness to avoid casting, this is not anymore needed in Java 8.
      */
     public static <T> Collection<T> anyCollectionOf(Class<T> clazz) {
         return anyCollection();
     }
 
     /**
-     * <code>Object</code> argument that implements the given class.
+     * Any <strong>non-null</strong> <code>Iterable</code>.
+     *
      * <p>
-     * See examples in javadoc for {@link ArgumentMatchers} class
+     * Since Mockito 2.0, only allow non-null <code>Iterable</code>.
+     * As this is a nullable reference, the suggested API to <strong>match</strong> <code>null</code>
+     * would be {@link #isNull()}. We felt this change would make tests harness much safer that it was with Mockito
+     * 1.x.
+     * </p>
      *
-     * @param <T>  the accepted type.
-     * @param type the class of the accepted type.
-     * @return <code>null</code>.
+     * <p>
+     * See examples in javadoc for {@link ArgumentMatchers} class.
+     * </p>
+     *
+     * @return empty Iterable.
+     * @see #anyIterableOf(Class)
+     * @see #isNull()
+     * @see #isNull(Class)
+     * @since 2.0.0
      */
-    public static <T> T isA(Class<T> type) {
-        reportMatcher(new InstanceOf(type));
+    public static Collection anyIterable() {
+        reportMatcher(new InstanceOf(Iterable.class, "<any iterable>"));
+        return new ArrayList(0);
+    }
 
-        return defaultValue(type);
+    /**
+     * Any <strong>non-null</strong> <code>Iterable</code>.
+     *
+     * <p>
+     * Generic friendly alias to {@link ArgumentMatchers#anyIterable()}.
+     * It's an alternative to <code>&#064;SuppressWarnings("unchecked")</code> to keep code clean of compiler warnings.
+     * </p>
+     *
+     * <p>
+     * This method doesn't do type checks of the iterable content with the given type parameter, it is only there
+     * to avoid casting in the code.
+     * </p>
+     *
+     * <p>
+     * Since Mockito 2.0, only allow non-null <code>String</code>.
+     * As strings are nullable reference, the suggested API to <strong>match</strong> <code>null</code> wrapper
+     * would be {@link #isNull()}. We felt this change would make tests harness much safer that it was with Mockito
+     * 1.x.
+     * </p>
+     *
+     * <p>
+     * See examples in javadoc for {@link ArgumentMatchers} class.
+     * </p>
+     *
+     * @param clazz Type owned by the collection to avoid casting
+     * @return empty Iterable.
+     * @see #anyIterable()
+     * @see #isNull()
+     * @see #isNull(Class)
+     * @since 2.0.0
+     * @deprecated With Java 8 this method will be removed in Mockito 3.0. This method is only used for generic
+     * friendliness to avoid casting, this is not anymore needed in Java 8.
+     */
+    public static <T> Iterable<T> anyIterableOf(Class<T> clazz) {
+        return anyIterable();
     }
 
+
+
     /**
      * <code>boolean</code> argument that is equal to the given value.
+     *
      * <p>
      * See examples in javadoc for {@link ArgumentMatchers} class
+     * </p>
      *
      * @param value the given value.
      * @return <code>0</code>.
@@ -410,8 +775,10 @@ public static boolean eq(boolean value) {
 
     /**
      * <code>byte</code> argument that is equal to the given value.
+     *
      * <p>
      * See examples in javadoc for {@link ArgumentMatchers} class
+     * </p>
      *
      * @param value the given value.
      * @return <code>0</code>.
@@ -423,8 +790,10 @@ public static byte eq(byte value) {
 
     /**
      * <code>char</code> argument that is equal to the given value.
+     *
      * <p>
      * See examples in javadoc for {@link ArgumentMatchers} class
+     * </p>
      *
      * @param value the given value.
      * @return <code>0</code>.
@@ -436,8 +805,10 @@ public static char eq(char value) {
 
     /**
      * <code>double</code> argument that is equal to the given value.
+     *
      * <p>
      * See examples in javadoc for {@link ArgumentMatchers} class
+     * </p>
      *
      * @param value the given value.
      * @return <code>0</code>.
@@ -449,8 +820,10 @@ public static double eq(double value) {
 
     /**
      * <code>float</code> argument that is equal to the given value.
+     *
      * <p>
      * See examples in javadoc for {@link ArgumentMatchers} class
+     * </p>
      *
      * @param value the given value.
      * @return <code>0</code>.
@@ -462,8 +835,10 @@ public static float eq(float value) {
 
     /**
      * <code>int</code> argument that is equal to the given value.
+     *
      * <p>
      * See examples in javadoc for {@link ArgumentMatchers} class
+     * </p>
      *
      * @param value the given value.
      * @return <code>0</code>.
@@ -475,8 +850,10 @@ public static int eq(int value) {
 
     /**
      * <code>long</code> argument that is equal to the given value.
+     *
      * <p>
      * See examples in javadoc for {@link ArgumentMatchers} class
+     * </p>
      *
      * @param value the given value.
      * @return <code>0</code>.
@@ -501,8 +878,10 @@ public static short eq(short value) {
 
     /**
      * Object argument that is equal to the given value.
+     *
      * <p>
      * See examples in javadoc for {@link ArgumentMatchers} class
+     * </p>
      *
      * @param value the given value.
      * @return <code>null</code>.
@@ -517,16 +896,22 @@ public static <T> T eq(T value) {
     /**
      * Object argument that is reflection-equal to the given value with support for excluding
      * selected fields from a class.
+     *
      * <p>
      * This matcher can be used when equals() is not implemented on compared objects.
      * Matcher uses java reflection API to compare fields of wanted and actual object.
+     * </p>
+     *
      * <p>
-     * Works similarly to EqualsBuilder.reflectionEquals(this, other, exlucdeFields) from
+     * Works similarly to <code>EqualsBuilder.reflectionEquals(this, other, exlucdeFields)</code> from
      * apache commons library.
      * <p>
      * <b>Warning</b> The equality check is shallow!
+     * </p>
+     *
      * <p>
      * See examples in javadoc for {@link ArgumentMatchers} class
+     * </p>
      *
      * @param value         the given value.
      * @param excludeFields fields to exclude, if field does not exist it is ignored.
@@ -539,8 +924,10 @@ public static <T> T refEq(T value, String... excludeFields) {
 
     /**
      * Object argument that is the same as the given value.
+     *
      * <p>
      * See examples in javadoc for {@link ArgumentMatchers} class
+     * </p>
      *
      * @param <T>   the type of the object, it is passed through to prevent casts.
      * @param value the given value.
@@ -555,83 +942,123 @@ public static <T> T same(T value) {
 
     /**
      * <code>null</code> argument.
+     *
      * <p>
      * See examples in javadoc for {@link ArgumentMatchers} class
+     * </p>
      *
      * @return <code>null</code>.
+     * @see #isNull(Class)
+     * @see #isNotNull()
+     * @see #isNotNull(Class)
      */
-    public static Object isNull() {
+    public static <T> T isNull() {
         reportMatcher(Null.NULL);
         return null;
     }
 
     /**
      * <code>null</code> argument.
+     *
+     * <p>
      * The class argument is provided to avoid casting.
+     * </p>
+     *
      * <p>
      * See examples in javadoc for {@link ArgumentMatchers} class
+     * </p>
      *
      * @param clazz Type to avoid casting
      * @return <code>null</code>.
+     * @see #isNull()
+     * @see #isNotNull()
+     * @see #isNotNull(Class)
+     * @deprecated With Java 8 this method will be removed in Mockito 3.0. This method is only used for generic
+     * friendliness to avoid casting, this is not anymore needed in Java 8.
      */
     public static <T> T isNull(Class<T> clazz) {
-        reportMatcher(Null.NULL);
-        return null;
+        return isNull();
     }
 
     /**
      * Not <code>null</code> argument.
+     *
      * <p>
-     * alias to {@link ArgumentMatchers#isNotNull()}
+     * Alias to {@link ArgumentMatchers#isNotNull()}
+     * </p>
+     *
      * <p>
      * See examples in javadoc for {@link ArgumentMatchers} class
+     * </p>
      *
      * @return <code>null</code>.
      */
-    public static Object notNull() {
+    public static <T> T notNull() {
         reportMatcher(NotNull.NOT_NULL);
         return null;
     }
 
     /**
      * Not <code>null</code> argument, not necessary of the given class.
+     *
+     * <p>
      * The class argument is provided to avoid casting.
+     *
+     * Alias to {@link ArgumentMatchers#isNotNull(Class)}
      * <p>
-     * alias to {@link ArgumentMatchers#isNotNull(Class)}
+     *
      * <p>
      * See examples in javadoc for {@link ArgumentMatchers} class
+     * </p>
      *
      * @param clazz Type to avoid casting
      * @return <code>null</code>.
+     * @see #isNotNull()
+     * @see #isNull()
+     * @see #isNull(Class)
+     * @deprecated With Java 8 this method will be removed in Mockito 3.0. This method is only used for generic
+     * friendliness to avoid casting, this is not anymore needed in Java 8.
      */
     public static <T> T notNull(Class<T> clazz) {
-        reportMatcher(NotNull.NOT_NULL);
-        return null;
+        return notNull();
     }
 
     /**
      * Not <code>null</code> argument.
+     *
      * <p>
-     * alias to {@link ArgumentMatchers#notNull()}
+     * Alias to {@link ArgumentMatchers#notNull()}
+     * </p>
+     *
      * <p>
      * See examples in javadoc for {@link ArgumentMatchers} class
+     * </p>
      *
      * @return <code>null</code>.
+     * @see #isNotNull(Class)
+     * @see #isNull()
+     * @see #isNull(Class)
      */
-    public static Object isNotNull() {
+    public static <T> T isNotNull() {
         return notNull();
     }
 
     /**
      * Not <code>null</code> argument, not necessary of the given class.
-     * The class argument is provided to avoid casting.
+     *
      * <p>
-     * alias to {@link ArgumentMatchers#notNull(Class)}
+     * The class argument is provided to avoid casting.
+     * Alias to {@link ArgumentMatchers#notNull(Class)}
+     * </p>
+     *
      * <p>
      * See examples in javadoc for {@link ArgumentMatchers} class
+     * </p>
      *
      * @param clazz Type to avoid casting
      * @return <code>null</code>.
+     * @deprecated With Java 8 this method will be removed in Mockito 3.0. This method is only used for generic
+     * friendliness to avoid casting, this is not anymore needed in Java 8.
      */
     public static <T> T isNotNull(Class<T> clazz) {
         return notNull(clazz);
@@ -691,13 +1118,19 @@ public static String startsWith(String prefix) {
 
     /**
      * Allows creating custom argument matchers.
+     *
+     * <p>
      * This API has changed in 2.0, please read {@link ArgumentMatcher} for rationale and migration guide.
      * <b>NullPointerException</b> auto-unboxing caveat is described below.
+     * </p>
+     *
      * <p>
      * It is important to understand the use cases and available options for dealing with non-trivial arguments
      * <b>before</b> implementing custom argument matchers. This way, you can select the best possible approach
      * for given scenario and produce highest quality test (clean and maintainable).
      * Please read the documentation for {@link ArgumentMatcher} to learn about approaches and see the examples.
+     * </p>
+     *
      * <p>
      * <b>NullPointerException</b> auto-unboxing caveat.
      * In rare cases when matching primitive parameter types you <b>*must*</b> use relevant intThat(), floatThat(), etc. method.
@@ -705,8 +1138,11 @@ public static String startsWith(String prefix) {
      * Due to how java works we don't really have a clean way of detecting this scenario and protecting the user from this problem.
      * Hopefully, the javadoc describes the problem and solution well.
      * If you have an idea how to fix the problem, let us know via the mailing list or the issue tracker.
+     * </p>
+     *
      * <p>
      * See examples in javadoc for {@link ArgumentMatcher} class
+     * </p>
      *
      * @param matcher decides whether argument matches
      * @return <code>null</code>.
@@ -718,6 +1154,7 @@ public static <T> T argThat(ArgumentMatcher<T> matcher) {
 
     /**
      * Allows creating custom <code>char</code> argument matchers.
+     *
      * Note that {@link #argThat} will not work with primitive <code>char</code> matchers due to <code>NullPointerException</code> auto-unboxing caveat.
      * <p>
      * See examples in javadoc for {@link ArgumentMatchers} class
@@ -732,6 +1169,7 @@ public static char charThat(ArgumentMatcher<Character> matcher) {
 
     /**
      * Allows creating custom <code>boolean</code> argument matchers.
+     *
      * Note that {@link #argThat} will not work with primitive <code>boolean</code> matchers due to <code>NullPointerException</code> auto-unboxing caveat.
      * <p>
      * See examples in javadoc for {@link ArgumentMatchers} class
@@ -746,6 +1184,7 @@ public static boolean booleanThat(ArgumentMatcher<Boolean> matcher) {
 
     /**
      * Allows creating custom <code>byte</code> argument matchers.
+     *
      * Note that {@link #argThat} will not work with primitive <code>byte</code> matchers due to <code>NullPointerException</code> auto-unboxing caveat.
      * <p>
      * See examples in javadoc for {@link ArgumentMatchers} class
@@ -760,6 +1199,7 @@ public static byte byteThat(ArgumentMatcher<Byte> matcher) {
 
     /**
      * Allows creating custom <code>short</code> argument matchers.
+     *
      * Note that {@link #argThat} will not work with primitive <code>short</code> matchers due to <code>NullPointerException</code> auto-unboxing caveat.
      * <p>
      * See examples in javadoc for {@link ArgumentMatchers} class
@@ -774,6 +1214,7 @@ public static short shortThat(ArgumentMatcher<Short> matcher) {
 
     /**
      * Allows creating custom <code>int</code> argument matchers.
+     *
      * Note that {@link #argThat} will not work with primitive <code>int</code> matchers due to <code>NullPointerException</code> auto-unboxing caveat.
      * <p>
      * See examples in javadoc for {@link ArgumentMatchers} class
@@ -788,6 +1229,7 @@ public static int intThat(ArgumentMatcher<Integer> matcher) {
 
     /**
      * Allows creating custom <code>long</code> argument matchers.
+     *
      * Note that {@link #argThat} will not work with primitive <code>long</code> matchers due to <code>NullPointerException</code> auto-unboxing caveat.
      * <p>
      * See examples in javadoc for {@link ArgumentMatchers} class
@@ -802,6 +1244,7 @@ public static long longThat(ArgumentMatcher<Long> matcher) {
 
     /**
      * Allows creating custom <code>float</code> argument matchers.
+     *
      * Note that {@link #argThat} will not work with primitive <code>float</code> matchers due to <code>NullPointerException</code> auto-unboxing caveat.
      * <p>
      * See examples in javadoc for {@link ArgumentMatchers} class
@@ -816,6 +1259,7 @@ public static float floatThat(ArgumentMatcher<Float> matcher) {
 
     /**
      * Allows creating custom <code>double</code> argument matchers.
+     *
      * Note that {@link #argThat} will not work with primitive <code>double</code> matchers due to <code>NullPointerException</code> auto-unboxing caveat.
      * <p>
      * See examples in javadoc for {@link ArgumentMatchers} class
diff --git a/src/main/java/org/mockito/internal/matchers/InstanceOf.java b/src/main/java/org/mockito/internal/matchers/InstanceOf.java
index c315c34ee4..2876aa24d0 100644
--- a/src/main/java/org/mockito/internal/matchers/InstanceOf.java
+++ b/src/main/java/org/mockito/internal/matchers/InstanceOf.java
@@ -6,6 +6,7 @@
 package org.mockito.internal.matchers;
 
 import org.mockito.ArgumentMatcher;
+import org.mockito.internal.util.Primitives;
 
 import java.io.Serializable;
 
@@ -13,16 +14,37 @@
 public class InstanceOf implements ArgumentMatcher<Object>, Serializable {
 
     private final Class<?> clazz;
+    private String description;
 
     public InstanceOf(Class<?> clazz) {
+        this(clazz, "isA(" + clazz.getCanonicalName() + ")");
+    }
+
+    public InstanceOf(Class<?> clazz, String describedAs) {
         this.clazz = clazz;
+        this.description = describedAs;
     }
 
     public boolean matches(Object actual) {
-        return (actual != null) && clazz.isAssignableFrom(actual.getClass());
+        return (actual != null) &&
+                (Primitives.isAssignableFromWrapper(actual.getClass(), clazz)
+                        || clazz.isAssignableFrom(actual.getClass()));
     }
 
     public String toString() {
-        return "isA(" + clazz.getName() + ")";
+        return description;
+    }
+
+    public static class VarArgAware extends InstanceOf implements VarargMatcher {
+
+        public VarArgAware(Class<?> clazz) {
+            super(clazz);
+        }
+
+        public VarArgAware(Class<?> clazz, String describedAs) {
+            super(clazz, describedAs);
+        }
     }
+
+
 }
diff --git a/src/main/java/org/mockito/internal/util/Primitives.java b/src/main/java/org/mockito/internal/util/Primitives.java
index e7a2f99c24..1540326129 100644
--- a/src/main/java/org/mockito/internal/util/Primitives.java
+++ b/src/main/java/org/mockito/internal/util/Primitives.java
@@ -42,6 +42,13 @@ public static boolean isPrimitiveOrWrapper(Class<?> type) {
         return PRIMITIVE_OR_WRAPPER_DEFAULT_VALUES.containsKey(type);
     }
 
+    public static boolean isAssignableFromWrapper(Class<?> valueClass, Class<?> referenceType) {
+        if(isPrimitiveOrWrapper(valueClass) && isPrimitiveOrWrapper(referenceType)) {
+            return Primitives.primitiveTypeOf(valueClass).isAssignableFrom(referenceType);
+        }
+        return false;
+    }
+
     /**
      * Returns the boxed default value for a primitive or a primitive wrapper.
      *


Test patch:
diff --git a/src/test/java/org/mockito/internal/exceptions/stacktrace/ConditionalStackTraceFilterTest.java b/src/test/java/org/mockito/internal/exceptions/stacktrace/ConditionalStackTraceFilterTest.java
index 64a5a39c52..88e2727b1e 100644
--- a/src/test/java/org/mockito/internal/exceptions/stacktrace/ConditionalStackTraceFilterTest.java
+++ b/src/test/java/org/mockito/internal/exceptions/stacktrace/ConditionalStackTraceFilterTest.java
@@ -4,12 +4,13 @@
  */
 package org.mockito.internal.exceptions.stacktrace;
 
+import org.assertj.core.api.Assertions;
 import org.junit.Test;
 import org.mockito.exceptions.base.TraceBuilder;
 import org.mockito.internal.configuration.ConfigurationAccess;
 import org.mockitoutil.TestBase;
 
-import static org.mockitoutil.ExtraMatchers.hasOnlyThoseClassesInStackTrace;
+import static org.mockitoutil.Conditions.onlyThoseClassesInStackTrace;
 
 public class ConditionalStackTraceFilterTest extends TestBase {
     
@@ -26,7 +27,7 @@ public void shouldNotFilterWhenConfigurationSaysNo() {
         
         filter.filter(t);
         
-        assertThat(t, hasOnlyThoseClassesInStackTrace("org.mockito.Mockito", "org.test.MockitoSampleTest"));
+        Assertions.assertThat(t).has(onlyThoseClassesInStackTrace("org.mockito.Mockito", "org.test.MockitoSampleTest"));
     }
 
     @Test
@@ -40,6 +41,6 @@ public void shouldFilterWhenConfigurationSaysYes() {
         
         filter.filter(t);
         
-        assertThat(t, hasOnlyThoseClassesInStackTrace("org.test.MockitoSampleTest"));
+        Assertions.assertThat(t).has(onlyThoseClassesInStackTrace("org.test.MockitoSampleTest"));
     }
 }
diff --git a/src/test/java/org/mockito/internal/exceptions/stacktrace/StackTraceFilterTest.java b/src/test/java/org/mockito/internal/exceptions/stacktrace/StackTraceFilterTest.java
index ff33eab770..27ee551479 100644
--- a/src/test/java/org/mockito/internal/exceptions/stacktrace/StackTraceFilterTest.java
+++ b/src/test/java/org/mockito/internal/exceptions/stacktrace/StackTraceFilterTest.java
@@ -5,12 +5,13 @@
 
 package org.mockito.internal.exceptions.stacktrace;
 
+import org.assertj.core.api.Assertions;
 import org.junit.Test;
 import org.mockito.exceptions.base.TraceBuilder;
 import org.mockitoutil.TestBase;
 
 import static junit.framework.TestCase.assertEquals;
-import static org.mockitoutil.ExtraMatchers.hasOnlyThoseClasses;
+import static org.mockitoutil.Conditions.onlyThoseClasses;
 
 public class StackTraceFilterTest extends TestBase {
     
@@ -25,7 +26,7 @@ public void shouldFilterOutCglibGarbage() {
         
         StackTraceElement[] filtered = filter.filter(t, false);
         
-        assertThat(filtered, hasOnlyThoseClasses("MockitoExampleTest"));
+        Assertions.assertThat(filtered).has(onlyThoseClasses("MockitoExampleTest"));
     }
 
     @Test
@@ -37,7 +38,7 @@ public void shouldFilterOutByteBuddyGarbage() {
 
         StackTraceElement[] filtered = filter.filter(t, false);
 
-        assertThat(filtered, hasOnlyThoseClasses("MockitoExampleTest"));
+        Assertions.assertThat(filtered).has(onlyThoseClasses("MockitoExampleTest"));
     }
 
 
@@ -49,8 +50,8 @@ public void shouldFilterOutMockitoPackage() {
         ).toTraceArray();
             
         StackTraceElement[] filtered = filter.filter(t, false);
-        
-        assertThat(filtered, hasOnlyThoseClasses("org.test.MockitoSampleTest"));
+
+        Assertions.assertThat(filtered).has(onlyThoseClasses("org.test.MockitoSampleTest"));
     }
     
     @Test
@@ -64,8 +65,8 @@ public void shouldNotFilterOutTracesMiddleGoodTraces() {
         ).toTraceArray();
         
         StackTraceElement[] filtered = filter.filter(t, false);
-        
-        assertThat(filtered, hasOnlyThoseClasses("org.test.TestSupport", "org.test.TestSupport", "org.test.MockitoSampleTest"));
+
+        Assertions.assertThat(filtered).has(onlyThoseClasses("org.test.TestSupport", "org.test.TestSupport", "org.test.MockitoSampleTest"));
     }
     
     @Test
@@ -78,8 +79,8 @@ public void shouldKeepRunners() {
         ).toTraceArray();
         
         StackTraceElement[] filtered = filter.filter(t, false);
-        
-        assertThat(filtered, hasOnlyThoseClasses("org.test.MockitoSampleTest", "junit.stuff", "org.mockito.runners.Runner"));
+
+        Assertions.assertThat(filtered).has(onlyThoseClasses("org.test.MockitoSampleTest", "junit.stuff", "org.mockito.runners.Runner"));
     }
 
     @Test
@@ -95,7 +96,7 @@ public void shouldNotFilterElementsAboveMockitoJUnitRule() {
 
         StackTraceElement[] filtered = filter.filter(t, false);
 
-        assertThat(filtered, hasOnlyThoseClasses("org.test.MockitoSampleTest", "junit.stuff", "org.mockito.runners.Runner","org.mockito.internal.junit.JUnitRule$1.evaluate(JUnitRule.java:16)"));
+        Assertions.assertThat(filtered).has(onlyThoseClasses("org.test.MockitoSampleTest", "junit.stuff", "org.mockito.runners.Runner","org.mockito.internal.junit.JUnitRule$1.evaluate(JUnitRule.java:16)"));
     }
     
     @Test
@@ -106,8 +107,8 @@ public void shouldKeepInternalRunners() {
         ).toTraceArray();
         
         StackTraceElement[] filtered = filter.filter(t, false);
-        
-        assertThat(filtered, hasOnlyThoseClasses("org.test.MockitoSampleTest", "org.mockito.internal.runners.Runner"));
+
+        Assertions.assertThat(filtered).has(onlyThoseClasses("org.test.MockitoSampleTest", "org.mockito.internal.runners.Runner"));
     }
     
     @Test
@@ -123,7 +124,7 @@ public void shouldStartFilteringAndKeepTop() {
         StackTraceElement[] filtered = filter.filter(t, true);
         
         //then
-        assertThat(filtered, hasOnlyThoseClasses("org.test.MockitoSampleTest", "org.test.Good"));
+        Assertions.assertThat(filtered).has(onlyThoseClasses("org.test.MockitoSampleTest", "org.test.Good"));
     }
 
     @Test
@@ -136,8 +137,8 @@ public void shouldKeepGoodTraceFromTheTopBecauseRealImplementationsOfSpiesSometi
         ).toTraceArray();
         
         StackTraceElement[] filtered = filter.filter(t, true);
-        
-        assertThat(filtered, hasOnlyThoseClasses(
+
+        Assertions.assertThat(filtered).has(onlyThoseClasses(
                 "org.test.MockitoSampleTest",
                 "org.yet.another.good.Trace",
                 "org.good.Trace"
diff --git a/src/test/java/org/mockito/internal/invocation/InvocationImplTest.java b/src/test/java/org/mockito/internal/invocation/InvocationImplTest.java
index 39d1c32024..5c68e7c536 100644
--- a/src/test/java/org/mockito/internal/invocation/InvocationImplTest.java
+++ b/src/test/java/org/mockito/internal/invocation/InvocationImplTest.java
@@ -5,6 +5,7 @@
 
 package org.mockito.internal.invocation;
 
+import org.assertj.core.api.Assertions;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.exceptions.base.MockitoException;
@@ -69,45 +70,45 @@ public void shouldPrintMethodName() {
     @Test
     public void shouldPrintMethodArgs() {
         invocation = new InvocationBuilder().args("foo").toInvocation();
-        assertThat(invocation.toString(), endsWith("simpleMethod(\"foo\");"));
+        Assertions.assertThat(invocation.toString()).endsWith("simpleMethod(\"foo\");");
     }
     
     @Test
     public void shouldPrintMethodIntegerArgAndString() {
         invocation = new InvocationBuilder().args("foo", 1).toInvocation();
-        assertThat(invocation.toString(), endsWith("simpleMethod(\"foo\", 1);"));
+        Assertions.assertThat(invocation.toString()).endsWith("simpleMethod(\"foo\", 1);");
     }
     
     @Test
     public void shouldPrintNull() {
         invocation = new InvocationBuilder().args((String) null).toInvocation();
-        assertThat(invocation.toString(), endsWith("simpleMethod(null);"));
+        Assertions.assertThat(invocation.toString()).endsWith("simpleMethod(null);");
     }
     
     @Test
     public void shouldPrintArray() {
         invocation = new InvocationBuilder().method("oneArray").args(new int[] { 1, 2, 3 }).toInvocation();
-        assertThat(invocation.toString(), endsWith("oneArray([1, 2, 3]);"));
+        Assertions.assertThat(invocation.toString()).endsWith("oneArray([1, 2, 3]);");
     }
     
     @Test
     public void shouldPrintNullIfArrayIsNull() throws Exception {
         Method m = IMethods.class.getMethod("oneArray", Object[].class);
         invocation = new InvocationBuilder().method(m).args((Object) null).toInvocation();
-        assertThat(invocation.toString(), endsWith("oneArray(null);"));
+        Assertions.assertThat(invocation.toString()).endsWith("oneArray(null);");
     }
     
     @Test
     public void shouldPrintArgumentsInMultilinesWhenGetsTooBig() {
         invocation = new InvocationBuilder().args("veeeeery long string that makes it ugly in one line", 1).toInvocation();
-        assertThat(invocation.toString(), endsWith(
+        Assertions.assertThat(invocation.toString()).endsWith(
                 "simpleMethod(" +
                         "\n" +
                         "    \"veeeeery long string that makes it ugly in one line\"," +
                         "\n" +
                         "    1" +
                         "\n" +
-                        ");"));
+                        ");");
     }
     
     @Test
diff --git a/src/test/java/org/mockito/internal/invocation/InvocationsFinderTest.java b/src/test/java/org/mockito/internal/invocation/InvocationsFinderTest.java
index c34a0258a8..6425ba877b 100644
--- a/src/test/java/org/mockito/internal/invocation/InvocationsFinderTest.java
+++ b/src/test/java/org/mockito/internal/invocation/InvocationsFinderTest.java
@@ -5,6 +5,7 @@
 
 package org.mockito.internal.invocation;
 
+import org.assertj.core.api.Assertions;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mock;
@@ -20,8 +21,9 @@
 import java.util.LinkedList;
 import java.util.List;
 
-import static junit.framework.TestCase.*;
-import static org.mockitoutil.ExtraMatchers.hasExactlyInOrder;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.assertSame;
+import static junit.framework.TestCase.assertTrue;
 
 
 public class InvocationsFinderTest extends TestBase {
@@ -48,10 +50,10 @@ public void setup() throws Exception {
     @Test
     public void shouldFindActualInvocations() throws Exception {
         List<Invocation> actual = InvocationsFinder.findInvocations(invocations, new InvocationMatcher(simpleMethodInvocation));
-        assertThat(actual, hasExactlyInOrder(simpleMethodInvocation, simpleMethodInvocationTwo));
+        Assertions.assertThat(actual).containsSequence(simpleMethodInvocation, simpleMethodInvocationTwo);
         
         actual = InvocationsFinder.findInvocations(invocations, new InvocationMatcher(differentMethodInvocation));
-        assertThat(actual, hasExactlyInOrder(differentMethodInvocation));
+        Assertions.assertThat(actual).containsSequence(differentMethodInvocation);
     }
     
     @Test
@@ -137,11 +139,11 @@ public void shouldGetLastStackTrace() throws Exception {
     @Test
     public void shouldFindAllMatchingUnverifiedChunks() throws Exception {
         List<Invocation> allMatching = InvocationsFinder.findAllMatchingUnverifiedChunks(invocations, new InvocationMatcher(simpleMethodInvocation), context);
-        assertThat(allMatching, hasExactlyInOrder(simpleMethodInvocation, simpleMethodInvocationTwo));
+        Assertions.assertThat(allMatching).containsSequence(simpleMethodInvocation, simpleMethodInvocationTwo);
         
         context.markVerified(simpleMethodInvocation);
         allMatching = InvocationsFinder.findAllMatchingUnverifiedChunks(invocations, new InvocationMatcher(simpleMethodInvocation), context);
-        assertThat(allMatching, hasExactlyInOrder(simpleMethodInvocationTwo));
+        Assertions.assertThat(allMatching).containsSequence(simpleMethodInvocationTwo);
         
         context.markVerified(simpleMethodInvocationTwo);
         allMatching = InvocationsFinder.findAllMatchingUnverifiedChunks(invocations, new InvocationMatcher(simpleMethodInvocation), context);
@@ -151,7 +153,7 @@ public void shouldFindAllMatchingUnverifiedChunks() throws Exception {
     @Test
     public void shouldFindMatchingChunk() throws Exception {
         List<Invocation> chunk = InvocationsFinder.findMatchingChunk(invocations, new InvocationMatcher(simpleMethodInvocation), 2, context);
-        assertThat(chunk, hasExactlyInOrder(simpleMethodInvocation, simpleMethodInvocationTwo));
+        Assertions.assertThat(chunk).containsSequence(simpleMethodInvocation, simpleMethodInvocationTwo);
     }
     
     @Test
@@ -160,7 +162,7 @@ public void shouldReturnAllChunksWhenModeIsAtLeastOnce() throws Exception {
         invocations.add(simpleMethodInvocationThree);
         
         List<Invocation> chunk = InvocationsFinder.findMatchingChunk(invocations, new InvocationMatcher(simpleMethodInvocation), 1, context);
-        assertThat(chunk, hasExactlyInOrder(simpleMethodInvocation, simpleMethodInvocationTwo, simpleMethodInvocationThree));
+        Assertions.assertThat(chunk).containsSequence(simpleMethodInvocation, simpleMethodInvocationTwo, simpleMethodInvocationThree);
     }
     
     @Test
@@ -169,7 +171,7 @@ public void shouldReturnAllChunksWhenWantedCountDoesntMatch() throws Exception {
         invocations.add(simpleMethodInvocationThree);
         
         List<Invocation> chunk = InvocationsFinder.findMatchingChunk(invocations, new InvocationMatcher(simpleMethodInvocation), 1, context);
-        assertThat(chunk, hasExactlyInOrder(simpleMethodInvocation, simpleMethodInvocationTwo, simpleMethodInvocationThree));
+        Assertions.assertThat(chunk).containsSequence(simpleMethodInvocation, simpleMethodInvocationTwo, simpleMethodInvocationThree);
     }
     
     @Test
diff --git a/src/test/java/org/mockito/internal/matchers/InstanceOfTest.java b/src/test/java/org/mockito/internal/matchers/InstanceOfTest.java
new file mode 100644
index 0000000000..4497c7c60a
--- /dev/null
+++ b/src/test/java/org/mockito/internal/matchers/InstanceOfTest.java
@@ -0,0 +1,64 @@
+package org.mockito.internal.matchers;
+
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class InstanceOfTest {
+
+    @Test
+    public void should_describe_the_matcher() {
+        assertThat(new InstanceOf(Object.class).toString()).contains("isA")
+                                                           .contains("Object");
+        assertThat(new InstanceOf(Object[].class).toString()).contains("isA")
+                                                           .contains("Object[]");
+        assertThat(new InstanceOf(Object.class, "matches something").toString()).isEqualTo("matches something");
+    }
+
+    @Test
+    public void should_check_instance_type() {
+        assertThat(new InstanceOf(Object.class).matches(new Object())).isTrue();
+        assertThat(new InstanceOf(Object.class).matches(new ArrayList())).isTrue();
+        assertThat(new InstanceOf(List.class).matches(new ArrayList())).isTrue();
+        assertThat(new InstanceOf(List.class).matches(new Object())).isFalse();
+    }
+
+    @Test
+    public void should_check_for_primitive_wrapper_types() {
+        assertThat(new InstanceOf(int.class).matches(1000)).isTrue();
+        assertThat(new InstanceOf(Integer.class).matches(1000)).isTrue();
+        assertThat(new InstanceOf(int.class).matches(new Integer(1000))).isTrue();
+        assertThat(new InstanceOf(Integer.class).matches(new Integer(1000))).isTrue();
+
+        assertThat(new InstanceOf(double.class).matches(1000.1)).isTrue();
+        assertThat(new InstanceOf(Double.class).matches(1000.1)).isTrue();
+        assertThat(new InstanceOf(double.class).matches(new Double(1000.1))).isTrue();
+        assertThat(new InstanceOf(Double.class).matches(new Double(1000.1))).isTrue();
+
+        assertThat(new InstanceOf(int.class).matches(1000L)).isFalse();
+        assertThat(new InstanceOf(Integer.class).matches(1000L)).isFalse();
+        assertThat(new InstanceOf(int.class).matches(new Long(1000))).isFalse();
+        assertThat(new InstanceOf(Integer.class).matches(new Long(1000))).isFalse();
+
+        assertThat(new InstanceOf(long.class).matches(1000L)).isTrue();
+        assertThat(new InstanceOf(Long.class).matches(1000L)).isTrue();
+        assertThat(new InstanceOf(long.class).matches(new Long(1000))).isTrue();
+        assertThat(new InstanceOf(Long.class).matches(new Long(1000))).isTrue();
+
+        assertThat(new InstanceOf(long.class).matches(1000)).isFalse();
+        assertThat(new InstanceOf(Long.class).matches(1000)).isFalse();
+        assertThat(new InstanceOf(long.class).matches(new Integer(1000))).isFalse();
+        assertThat(new InstanceOf(Long.class).matches(new Integer(1000))).isFalse();
+    }
+
+    @Test
+    public void can_be_vararg_aware() {
+        assertThat(new InstanceOf.VarArgAware(Number[].class)).isInstanceOf(VarargMatcher.class);
+        assertThat(new InstanceOf.VarArgAware(Number[].class).matches(new Integer[0])).isTrue();
+        assertThat(new InstanceOf.VarArgAware(Number[].class).matches(new Number[0])).isTrue();
+        assertThat(new InstanceOf.VarArgAware(Number[].class).matches(new Object[0])).isFalse();
+    }
+}
\ No newline at end of file
diff --git a/src/test/java/org/mockito/internal/progress/PrimitivesTest.java b/src/test/java/org/mockito/internal/progress/PrimitivesTest.java
deleted file mode 100644
index de24c6a383..0000000000
--- a/src/test/java/org/mockito/internal/progress/PrimitivesTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2007 Mockito contributors
- * This program is made available under the terms of the MIT License.
- */
-package org.mockito.internal.progress;
-
-import org.junit.Test;
-import org.mockito.internal.util.Primitives;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-
-public class PrimitivesTest {
-
-
-    @Test
-    public void should_not_return_null_for_primitives_wrappers() throws Exception {
-        assertNotNull(Primitives.defaultValue(Boolean.class));
-        assertNotNull(Primitives.defaultValue(Character.class));
-        assertNotNull(Primitives.defaultValue(Byte.class));
-        assertNotNull(Primitives.defaultValue(Short.class));
-        assertNotNull(Primitives.defaultValue(Integer.class));
-        assertNotNull(Primitives.defaultValue(Long.class));
-        assertNotNull(Primitives.defaultValue(Float.class));
-        assertNotNull(Primitives.defaultValue(Double.class));
-    }
-
-    @Test
-    public void should_not_return_null_for_primitives() throws Exception {
-        assertNotNull(Primitives.defaultValue(boolean.class));
-        assertNotNull(Primitives.defaultValue(char.class));
-        assertNotNull(Primitives.defaultValue(byte.class));
-        assertNotNull(Primitives.defaultValue(short.class));
-        assertNotNull(Primitives.defaultValue(int.class));
-        assertNotNull(Primitives.defaultValue(long.class));
-        assertNotNull(Primitives.defaultValue(float.class));
-        assertNotNull(Primitives.defaultValue(double.class));
-    }
-
-    @Test 
-    public void should_default_values_for_primitive() {
-        assertThat(Primitives.defaultValue(boolean.class)).isFalse();
-        assertThat(Primitives.defaultValue(char.class)).isEqualTo('\u0000');
-        assertThat(Primitives.defaultValue(byte.class)).isEqualTo((byte) 0);
-        assertThat(Primitives.defaultValue(short.class)).isEqualTo((short) 0);
-        assertThat(Primitives.defaultValue(int.class)).isEqualTo(0);
-        assertThat(Primitives.defaultValue(long.class)).isEqualTo(0L);
-        assertThat(Primitives.defaultValue(float.class)).isEqualTo(0.0F);
-        assertThat(Primitives.defaultValue(double.class)).isEqualTo(0.0D);
-    }
-    
-    @Test 
-    public void should_default_values_for_wrapper() {
-        assertThat(Primitives.defaultValue(Boolean.class)).isFalse();
-        assertThat(Primitives.defaultValue(Character.class)).isEqualTo('\u0000');
-        assertThat(Primitives.defaultValue(Byte.class)).isEqualTo((byte) 0);
-        assertThat(Primitives.defaultValue(Short.class)).isEqualTo((short) 0);
-        assertThat(Primitives.defaultValue(Integer.class)).isEqualTo(0);
-        assertThat(Primitives.defaultValue(Long.class)).isEqualTo(0L);
-        assertThat(Primitives.defaultValue(Float.class)).isEqualTo(0.0F);
-        assertThat(Primitives.defaultValue(Double.class)).isEqualTo(0.0D);
-    }
-
-    @Test
-    public void should_return_null_for_everything_else() throws Exception {
-        assertNull(Primitives.defaultValue(Object.class));
-        assertNull(Primitives.defaultValue(String.class));
-        assertNull(Primitives.defaultValue(null));
-    }
-}
\ No newline at end of file
diff --git a/src/test/java/org/mockito/internal/util/PrimitivesTest.java b/src/test/java/org/mockito/internal/util/PrimitivesTest.java
index 839763f820..2ea86c6118 100644
--- a/src/test/java/org/mockito/internal/util/PrimitivesTest.java
+++ b/src/test/java/org/mockito/internal/util/PrimitivesTest.java
@@ -12,8 +12,6 @@
 
 
 public class PrimitivesTest {
-
-
     @Test
     public void should_not_return_null_for_primitives_wrappers() throws Exception {
         assertNotNull(Primitives.defaultValue(Boolean.class));
@@ -68,4 +66,24 @@ public void should_return_null_for_everything_else() throws Exception {
         assertNull(Primitives.defaultValue(String.class));
         assertNull(Primitives.defaultValue(null));
     }
+
+    @Test
+    public void should_check_that_value_type_is_assignable_to_wrapper_reference() {
+        assertThat(Primitives.isAssignableFromWrapper(int.class, Integer.class));
+        assertThat(Primitives.isAssignableFromWrapper(Integer.class, Integer.class));
+        assertThat(Primitives.isAssignableFromWrapper(long.class, Long.class));
+        assertThat(Primitives.isAssignableFromWrapper(Long.class, Long.class));
+        assertThat(Primitives.isAssignableFromWrapper(double.class, Double.class));
+        assertThat(Primitives.isAssignableFromWrapper(Double.class, Double.class));
+        assertThat(Primitives.isAssignableFromWrapper(float.class, Float.class));
+        assertThat(Primitives.isAssignableFromWrapper(Float.class, Float.class));
+        assertThat(Primitives.isAssignableFromWrapper(char.class, Character.class));
+        assertThat(Primitives.isAssignableFromWrapper(Character.class, Character.class));
+        assertThat(Primitives.isAssignableFromWrapper(short.class, Short.class));
+        assertThat(Primitives.isAssignableFromWrapper(Short.class, Short.class));
+        assertThat(Primitives.isAssignableFromWrapper(byte.class, Byte.class));
+        assertThat(Primitives.isAssignableFromWrapper(Byte.class, Byte.class));
+        assertThat(Primitives.isAssignableFromWrapper(boolean.class, Boolean.class));
+        assertThat(Primitives.isAssignableFromWrapper(Boolean.class, Boolean.class));
+    }
 }
\ No newline at end of file
diff --git a/src/test/java/org/mockito/internal/util/TimerTest.java b/src/test/java/org/mockito/internal/util/TimerTest.java
index e1156688c1..49cd3c7cae 100644
--- a/src/test/java/org/mockito/internal/util/TimerTest.java
+++ b/src/test/java/org/mockito/internal/util/TimerTest.java
@@ -1,12 +1,11 @@
 package org.mockito.internal.util;
 
+import org.assertj.core.api.Assertions;
 import org.junit.Assert;
 import org.junit.Test;
 import org.mockito.exceptions.misusing.FriendlyReminderException;
 import org.mockitoutil.TestBase;
 
-import static org.hamcrest.CoreMatchers.is;
-
 public class TimerTest extends TestBase {
 
     @Test
@@ -19,7 +18,7 @@ public void should_return_true_if_task_is_in_acceptable_time_bounds() {
         timer.start();
 
         //then
-        assertThat(timer.isCounting(), is(true));
+        Assertions.assertThat(timer.isCounting()).isTrue();
     }
 
     @Test
@@ -32,7 +31,7 @@ public void should_return_false_when_time_run_out() throws Exception {
         oneMillisecondPasses();
 
         //then
-        assertThat(timer.isCounting(), is(false));
+        Assertions.assertThat(timer.isCounting()).isFalse();
     }
 
     @Test
diff --git a/src/test/java/org/mockito/internal/util/collections/ListUtilTest.java b/src/test/java/org/mockito/internal/util/collections/ListUtilTest.java
index 594fbc3d25..fcd4f9704a 100644
--- a/src/test/java/org/mockito/internal/util/collections/ListUtilTest.java
+++ b/src/test/java/org/mockito/internal/util/collections/ListUtilTest.java
@@ -5,6 +5,7 @@
 
 package org.mockito.internal.util.collections;
 
+import org.assertj.core.api.Assertions;
 import org.junit.Test;
 import org.mockito.internal.util.collections.ListUtil.Filter;
 import org.mockitoutil.TestBase;
@@ -14,7 +15,6 @@
 
 import static java.util.Arrays.asList;
 import static junit.framework.TestCase.assertTrue;
-import static org.mockitoutil.ExtraMatchers.hasExactlyInOrder;
 
 public class ListUtilTest extends TestBase {
 
@@ -26,8 +26,8 @@ public boolean isOut(String object) {
                 return object == "x";
             }
         });
-        
-        assertThat(filtered, hasExactlyInOrder("one", "two", "three"));
+
+        Assertions.assertThat(filtered).containsSequence("one", "two", "three");
     }
     
     @Test
diff --git a/src/test/java/org/mockitousage/IMethods.java b/src/test/java/org/mockitousage/IMethods.java
index a18d04697d..7234bd7976 100644
--- a/src/test/java/org/mockitousage/IMethods.java
+++ b/src/test/java/org/mockitousage/IMethods.java
@@ -190,6 +190,8 @@ public interface IMethods {
 
     String forCollection(Collection<String> collection);
 
+    String forIterable(Iterable<String> iterable);
+
     Object[] arrayReturningMethod();
 
     IMethods iMethodsReturningMethod();
@@ -202,6 +204,8 @@ public interface IMethods {
 
     Object collectionArgMethod(Collection<String> collection);
 
+    Object iterableArgMethod(Iterable<String> collection);
+
     Object setArgMethod(Set<String> set);
 
     void longArg(long longArg);
diff --git a/src/test/java/org/mockitousage/MethodsImpl.java b/src/test/java/org/mockitousage/MethodsImpl.java
index cc4fb4155d..4f4bdcc8d8 100644
--- a/src/test/java/org/mockitousage/MethodsImpl.java
+++ b/src/test/java/org/mockitousage/MethodsImpl.java
@@ -363,6 +363,10 @@ public String forCollection(Collection<String> collection) {
         return null;
     }
 
+    public String forIterable(Iterable<String> iterable) {
+        return null;
+    }
+
     public Object[] arrayReturningMethod() {
         return new Object[0];
     }
@@ -387,6 +391,10 @@ public Object collectionArgMethod(Collection<String> collection) {
         return null;
     }
 
+    public Object iterableArgMethod(Iterable<String> iterable) {
+        return null;
+    }
+
     public Object setArgMethod(Set<String> set) {
         return null;
     }
diff --git a/src/test/java/org/mockitousage/basicapi/ReplacingObjectMethodsTest.java b/src/test/java/org/mockitousage/basicapi/ReplacingObjectMethodsTest.java
index bc79a68e5e..dc6258c297 100644
--- a/src/test/java/org/mockitousage/basicapi/ReplacingObjectMethodsTest.java
+++ b/src/test/java/org/mockitousage/basicapi/ReplacingObjectMethodsTest.java
@@ -5,13 +5,12 @@
 
 package org.mockitousage.basicapi;
 
+import org.assertj.core.api.Assertions;
 import org.junit.Test;
 import org.mockito.Mockito;
 import org.mockitoutil.TestBase;
 
 import static junit.framework.TestCase.assertEquals;
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.not;
 
 public class ReplacingObjectMethodsTest extends TestBase {
 
@@ -30,12 +29,11 @@ public void shouldProvideMockyImplementationOfToString() {
     public void shouldReplaceObjectMethods() {
         Object mock = Mockito.mock(ObjectMethodsOverridden.class);
         Object otherMock = Mockito.mock(ObjectMethodsOverridden.class);
-        
-        assertThat(mock, equalTo(mock));
-        assertThat(mock, not(equalTo(otherMock)));
-        
-        assertThat(mock.hashCode(), not(equalTo(otherMock.hashCode())));
-        
+
+        Assertions.assertThat(mock).isEqualTo(mock);
+        Assertions.assertThat(mock).isNotEqualTo(otherMock);
+        Assertions.assertThat(mock.hashCode()).isNotEqualTo(otherMock.hashCode());
+
         assertContains("Mock for ObjectMethodsOverridden", mock.toString());
     }
     
@@ -43,12 +41,11 @@ public void shouldReplaceObjectMethods() {
     public void shouldReplaceObjectMethodsWhenOverridden() {
         Object mock = Mockito.mock(ObjectMethodsOverriddenSubclass.class);
         Object otherMock = Mockito.mock(ObjectMethodsOverriddenSubclass.class);
-        
-        assertThat(mock, equalTo(mock));
-        assertThat(mock, not(equalTo(otherMock)));
-        
-        assertThat(mock.hashCode(), not(equalTo(otherMock.hashCode())));
-        
+
+        Assertions.assertThat(mock).isEqualTo(mock);
+        Assertions.assertThat(mock).isNotEqualTo(otherMock);
+        Assertions.assertThat(mock.hashCode()).isNotEqualTo(otherMock.hashCode());
+
         assertContains("Mock for ObjectMethodsOverriddenSubclass", mock.toString());
     }
     
diff --git a/src/test/java/org/mockitousage/internal/invocation/realmethod/CleanTraceRealMethodTest.java b/src/test/java/org/mockitousage/internal/invocation/realmethod/CleanTraceRealMethodTest.java
index 48ee1e31be..10ec3da6b5 100644
--- a/src/test/java/org/mockitousage/internal/invocation/realmethod/CleanTraceRealMethodTest.java
+++ b/src/test/java/org/mockitousage/internal/invocation/realmethod/CleanTraceRealMethodTest.java
@@ -4,6 +4,7 @@
  */
 package org.mockitousage.internal.invocation.realmethod;
 
+import org.assertj.core.api.Assertions;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.internal.invocation.realmethod.CleanTraceRealMethod;
@@ -11,7 +12,7 @@
 import org.mockitoutil.TestBase;
 
 import static junit.framework.TestCase.fail;
-import static org.mockitoutil.ExtraMatchers.hasMethodInStackTraceAt;
+import static org.mockitoutil.Conditions.methodInStackTraceAt;
 
 public class CleanTraceRealMethodTest extends TestBase {
 
@@ -42,9 +43,9 @@ public Object invoke(Object target, Object[] arguments) throws Throwable {
             fail();
         //then
         } catch (Exception e) {
-            assertThat(e, hasMethodInStackTraceAt(0, "throwSomething"));
-            assertThat(e, hasMethodInStackTraceAt(1, "invoke"));
-            assertThat(e, hasMethodInStackTraceAt(2, "shouldRemoveMockitoInternalsFromStackTraceWhenRealMethodThrows"));
+            Assertions.assertThat(e).has(methodInStackTraceAt(0, "throwSomething"));
+            Assertions.assertThat(e).has(methodInStackTraceAt(1, "invoke"));
+            Assertions.assertThat(e).has(methodInStackTraceAt(2, "shouldRemoveMockitoInternalsFromStackTraceWhenRealMethodThrows"));
         }
     }
 }
\ No newline at end of file
diff --git a/src/test/java/org/mockitousage/junitrunner/SilentRunnerTest.java b/src/test/java/org/mockitousage/junitrunner/SilentRunnerTest.java
index 134bea8944..df90dc10d2 100644
--- a/src/test/java/org/mockitousage/junitrunner/SilentRunnerTest.java
+++ b/src/test/java/org/mockitousage/junitrunner/SilentRunnerTest.java
@@ -9,12 +9,16 @@
 import org.mockito.exceptions.verification.TooLittleActualInvocations;
 import org.mockito.runners.MockitoJUnitRunner;
 import org.mockitousage.IMethods;
+import org.mockitoutil.JUnitResultAssert;
 import org.mockitoutil.TestBase;
 
 import java.util.List;
 
 import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.*;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 /**
  * Created by sfaber on 4/22/16.
@@ -29,7 +33,7 @@ public class SilentRunnerTest extends TestBase {
                 SomeFeature.class
         );
         //then
-        assertThat(result).isSuccessful();
+        JUnitResultAssert.assertThat(result).isSuccessful();
     }
 
     @Test public void failing_test() {
@@ -38,7 +42,7 @@ public class SilentRunnerTest extends TestBase {
                 SomeFailingFeature.class
         );
         //then
-        assertThat(result).fails(1, TooLittleActualInvocations.class);
+        JUnitResultAssert.assertThat(result).fails(1, TooLittleActualInvocations.class);
     }
 
     @Test public void validates_framework_usage() {
@@ -47,7 +51,7 @@ public class SilentRunnerTest extends TestBase {
                 UsesFrameworkIncorrectly.class
         );
         //then
-        assertThat(result).fails(1, UnfinishedStubbingException.class);
+        JUnitResultAssert.assertThat(result).fails(1, UnfinishedStubbingException.class);
     }
 
     @Test
@@ -56,7 +60,7 @@ public void ignores_unused_stubs() {
         //when
         Result result = runner.run(HasUnnecessaryStubs.class);
         //then
-        assertThat(result).isSuccessful();
+        JUnitResultAssert.assertThat(result).isSuccessful();
     }
 
     @RunWith(MockitoJUnitRunner.Silent.class)
diff --git a/src/test/java/org/mockitousage/junitrunner/StrictRunnerTest.java b/src/test/java/org/mockitousage/junitrunner/StrictRunnerTest.java
index bcd298edb1..c12df6acbf 100644
--- a/src/test/java/org/mockitousage/junitrunner/StrictRunnerTest.java
+++ b/src/test/java/org/mockitousage/junitrunner/StrictRunnerTest.java
@@ -9,12 +9,14 @@
 import org.mockito.exceptions.misusing.UnnecessaryStubbingException;
 import org.mockito.runners.MockitoJUnitRunner;
 import org.mockitousage.IMethods;
+import org.mockitoutil.JUnitResultAssert;
 import org.mockitoutil.TestBase;
 
 import static org.junit.Assert.assertEquals;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
+
 /**
  * Created by sfaber on 4/22/16.
  */
@@ -30,7 +32,7 @@ public class StrictRunnerTest extends TestBase {
                 StubbingInTestUsed.class
         );
         //then
-        assertThat(result).isSuccessful();
+        JUnitResultAssert.assertThat(result).isSuccessful();
     }
 
     @Test public void fails_when_stubs_were_not_used() {
@@ -42,7 +44,7 @@ public class StrictRunnerTest extends TestBase {
         Result result = runner.run(tests);
 
         //then
-        assertThat(result).fails(3, UnnecessaryStubbingException.class);
+        JUnitResultAssert.assertThat(result).fails(3, UnnecessaryStubbingException.class);
     }
 
     @Test public void does_not_report_unused_stubs_when_different_failure_is_present() {
@@ -50,7 +52,7 @@ public class StrictRunnerTest extends TestBase {
         Result result = runner.run(WithUnrelatedAssertionFailure.class);
 
         //then
-        assertThat(result).fails(1, MyAssertionError.class);
+        JUnitResultAssert.assertThat(result).fails(1, MyAssertionError.class);
     }
 
     @RunWith(MockitoJUnitRunner.class)
diff --git a/src/test/java/org/mockitousage/matchers/MatchersTest.java b/src/test/java/org/mockitousage/matchers/MatchersTest.java
index 86f476cc84..46b0caeb52 100644
--- a/src/test/java/org/mockitousage/matchers/MatchersTest.java
+++ b/src/test/java/org/mockitousage/matchers/MatchersTest.java
@@ -436,6 +436,27 @@ public void nullMatcher() {
         assertEquals("2", mock.threeArgumentMethod(1, new Object(), ""));
     }
 
+    @Test
+    public void nullMatcherForPrimitiveWrappers() {
+        when(mock.forBoolean(isNull(Boolean.class))).thenReturn("ok");
+        when(mock.forInteger(isNull(Integer.class))).thenReturn("ok");
+        when(mock.forLong(isNull(Long.class))).thenReturn("ok");
+        when(mock.forByte(isNull(Byte.class))).thenReturn("ok");
+        when(mock.forShort(isNull(Short.class))).thenReturn("ok");
+        when(mock.forCharacter(isNull(Character.class))).thenReturn("ok");
+        when(mock.forDouble(isNull(Double.class))).thenReturn("ok");
+        when(mock.forFloat(isNull(Float.class))).thenReturn("ok");
+
+        assertEquals("ok", mock.forBoolean(null));
+        assertEquals("ok", mock.forInteger(null));
+        assertEquals("ok", mock.forLong(null));
+        assertEquals("ok", mock.forByte(null));
+        assertEquals("ok", mock.forShort(null));
+        assertEquals("ok", mock.forCharacter(null));
+        assertEquals("ok", mock.forDouble(null));
+        assertEquals("ok", mock.forFloat(null));
+    }
+
     @Test
     public void notNullMatcher() {
         when(mock.threeArgumentMethod(eq(1), notNull(), eq(""))).thenReturn("1");
diff --git a/src/test/java/org/mockitousage/matchers/MoreMatchersTest.java b/src/test/java/org/mockitousage/matchers/MoreMatchersTest.java
index 026905bae6..3471fe0a19 100644
--- a/src/test/java/org/mockitousage/matchers/MoreMatchersTest.java
+++ b/src/test/java/org/mockitousage/matchers/MoreMatchersTest.java
@@ -13,6 +13,7 @@
 import java.util.*;
 
 import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.fail;
 import static org.mockito.Matchers.*;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
@@ -22,22 +23,41 @@ public class MoreMatchersTest extends TestBase {
     @Mock private IMethods mock;
 
     @Test
-    public void shouldHelpOutWithUnnecessaryCasting() {
+    public void should_help_out_with_unnecessary_casting() {
         when(mock.objectArgMethod(any(String.class))).thenReturn("string");
 
         assertEquals("string", mock.objectArgMethod("foo"));
     }
 
     @Test
-    public void shouldAnyBeActualAliasToAnyObject() {
+    public void any_should_be_actual_alias_to_anyObject() {
         mock.simpleMethod((Object) null);
 
+        verify(mock).simpleMethod(any());
         verify(mock).simpleMethod(anyObject());
-        verify(mock).simpleMethod(any(Object.class));
     }
 
     @Test
-    public void shouldHelpOutWithUnnecessaryCastingOfLists() {
+    public void any_class_should_be_actual_alias_to_isA() {
+        mock.simpleMethod(new ArrayList());
+
+        verify(mock).simpleMethod(isA(List.class));
+        verify(mock).simpleMethod(any(List.class));
+
+
+        mock.simpleMethod((String) null);
+        try {
+            verify(mock).simpleMethod(isA(String.class));
+            fail();
+        } catch (AssertionError ignored) { }
+        try {
+            verify(mock).simpleMethod(any(String.class));
+            fail();
+        } catch (AssertionError ignored) { }
+    }
+
+    @Test
+    public void should_help_out_with_unnecessary_casting_of_lists() {
         //Below yields compiler warning:
         //when(mock.listArgMethod(anyList())).thenReturn("list");
         when(mock.listArgMethod(anyListOf(String.class))).thenReturn("list");
@@ -47,7 +67,7 @@ public void shouldHelpOutWithUnnecessaryCastingOfLists() {
     }
 
     @Test
-    public void shouldHelpOutWithUnnecessaryCastingOfSets() {
+    public void should_help_out_with_unnecessary_casting_of_sets() {
         //Below yields compiler warning:
         //when(mock.setArgMethod(anySet())).thenReturn("set");
         when(mock.setArgMethod(anySetOf(String.class))).thenReturn("set");
@@ -57,7 +77,7 @@ public void shouldHelpOutWithUnnecessaryCastingOfSets() {
     }
 
     @Test
-    public void shouldHelpOutWithUnnecessaryCastingOfMaps() {
+    public void should_help_out_with_unnecessary_casting_of_maps() {
         //Below yields compiler warning:
         //when(mock.setArgMethod(anySet())).thenReturn("set");
         when(mock.forMap(anyMapOf(String.class, String.class))).thenReturn("map");
@@ -67,17 +87,27 @@ public void shouldHelpOutWithUnnecessaryCastingOfMaps() {
     }
 
     @Test
-    public void shouldHelpOutWithUnnecessaryCastingOfCollections() {
+    public void should_help_out_with_unnecessary_casting_of_collections() {
+        //Below yields compiler warning:
+        //when(mock.setArgMethod(anySet())).thenReturn("set");
+        when(mock.collectionArgMethod(anyCollectionOf(String.class))).thenReturn("collection");
+
+        assertEquals("collection", mock.collectionArgMethod(new ArrayList<String>()));
+        assertEquals("collection", mock.collectionArgMethod(Collections.<String>emptyList()));
+    }
+
+    @Test
+    public void should_help_out_with_unnecessary_casting_of_iterables() {
         //Below yields compiler warning:
         //when(mock.setArgMethod(anySet())).thenReturn("set");
-        when(mock.collectionArgMethod(anyCollectionOf(String.class))).thenReturn("col");
+        when(mock.iterableArgMethod(anyIterableOf(String.class))).thenReturn("iterable");
 
-        assertEquals("col", mock.collectionArgMethod(new ArrayList<String>()));
-        assertEquals("col", mock.collectionArgMethod(Collections.<String>emptyList()));
+        assertEquals("iterable", mock.iterableArgMethod(new ArrayList<String>()));
+        assertEquals("iterable", mock.iterableArgMethod(Collections.<String>emptyList()));
     }
 
     @Test
-    public void shouldHelpOutWithUnnecessaryCastingOfNullityChecks() {
+    public void should_help_out_with_unnecessary_casting_of_nullity_checks() {
         when(mock.objectArgMethod(isNull(LinkedList.class))).thenReturn("string");
         when(mock.objectArgMethod(notNull(LinkedList.class))).thenReturn("string");
         when(mock.objectArgMethod(isNotNull(LinkedList.class))).thenReturn("string");
diff --git a/src/test/java/org/mockitousage/matchers/NewMatchersTest.java b/src/test/java/org/mockitousage/matchers/NewMatchersTest.java
index 89b31cf02d..7c1dcffe0b 100644
--- a/src/test/java/org/mockitousage/matchers/NewMatchersTest.java
+++ b/src/test/java/org/mockitousage/matchers/NewMatchersTest.java
@@ -70,4 +70,14 @@ public void shouldAllowAnySet() {
 
         verify(mock, times(1)).forSet(anySet());
     }
+
+    @Test
+    public void shouldAllowAnyIterable() {
+        when(mock.forIterable(anyIterable())).thenReturn("matched");
+
+        assertEquals("matched", mock.forIterable(new HashSet<String>()));
+        assertEquals(null, mock.forIterable(null));
+
+        verify(mock, times(1)).forIterable(anyIterable());
+    }
 }
\ No newline at end of file
diff --git a/src/test/java/org/mockitousage/puzzlers/BridgeMethodPuzzleTest.java b/src/test/java/org/mockitousage/puzzlers/BridgeMethodPuzzleTest.java
index 89a98fd664..a4c2061058 100644
--- a/src/test/java/org/mockitousage/puzzlers/BridgeMethodPuzzleTest.java
+++ b/src/test/java/org/mockitousage/puzzlers/BridgeMethodPuzzleTest.java
@@ -5,13 +5,14 @@
 
 package org.mockitousage.puzzlers;
 
+import org.assertj.core.api.Assertions;
 import org.junit.Test;
 import org.mockitoutil.TestBase;
 
 import static junit.framework.TestCase.assertEquals;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
-import static org.mockitoutil.ExtraMatchers.hasBridgeMethod;
+import static org.mockitoutil.Conditions.bridgeMethod;
 
 /**
  * Bridge method is generated by compiler when erasure in parent class is
@@ -42,8 +43,8 @@ public void shouldHaveBridgeMethod() throws Exception {
         
         assertEquals("Dummy says: Hello", s.say("Hello"));
         
-        assertThat(Sub.class, hasBridgeMethod("say"));
-        assertThat(s, hasBridgeMethod("say"));
+        Assertions.assertThat(Sub.class).has(bridgeMethod("say"));
+        Assertions.assertThat(s).has(bridgeMethod("say"));
     }
     
     @Test
diff --git a/src/test/java/org/mockitousage/spies/PartialMockingWithSpiesTest.java b/src/test/java/org/mockitousage/spies/PartialMockingWithSpiesTest.java
index a863f3a368..d70dc14cc5 100644
--- a/src/test/java/org/mockitousage/spies/PartialMockingWithSpiesTest.java
+++ b/src/test/java/org/mockitousage/spies/PartialMockingWithSpiesTest.java
@@ -5,14 +5,18 @@
 
 package org.mockitousage.spies;
 
+import org.assertj.core.api.Assertions;
 import org.junit.Before;
 import org.junit.Test;
-import org.mockitoutil.ExtraMatchers;
 import org.mockitoutil.TestBase;
 
 import static junit.framework.TestCase.assertEquals;
 import static junit.framework.TestCase.fail;
-import static org.mockito.Mockito.*;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.mockitoutil.Conditions.methodsInStackTrace;
 
 @SuppressWarnings("unchecked")
 public class PartialMockingWithSpiesTest extends TestBase {
@@ -105,7 +109,7 @@ public void shouldStackTraceGetFilteredOnUserExceptions() {
             fail();
         } catch (Throwable t) {
             // then
-            assertThat(t, ExtraMatchers.hasMethodsInStackTrace(
+            Assertions.assertThat(t).has(methodsInStackTrace(
                     "throwSomeException",
                     "getNameButDelegateToMethodThatThrows",
                     "shouldStackTraceGetFilteredOnUserExceptions"
diff --git a/src/test/java/org/mockitousage/spies/SpyingOnInterfacesTest.java b/src/test/java/org/mockitousage/spies/SpyingOnInterfacesTest.java
index 056603db94..22d6b26c77 100644
--- a/src/test/java/org/mockitousage/spies/SpyingOnInterfacesTest.java
+++ b/src/test/java/org/mockitousage/spies/SpyingOnInterfacesTest.java
@@ -11,6 +11,7 @@
 import net.bytebuddy.description.modifier.Visibility;
 import net.bytebuddy.dynamic.loading.ClassLoadingStrategy;
 import net.bytebuddy.implementation.FixedValue;
+import org.assertj.core.api.Assertions;
 import org.junit.Test;
 import org.mockito.exceptions.base.MockitoException;
 import org.mockito.invocation.InvocationOnMock;
@@ -20,9 +21,11 @@
 import java.util.List;
 
 import static junit.framework.TestCase.fail;
-import static org.hamcrest.core.Is.is;
 import static org.junit.Assume.assumeTrue;
-import static org.mockito.Mockito.*;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 @SuppressWarnings({"unchecked"})
 public class SpyingOnInterfacesTest extends TestBase {
@@ -77,7 +80,7 @@ public void shouldAllowDelegatingToDefaultMethod() throws Exception {
         //when
         when(type.getMethod("foo").invoke(object)).thenCallRealMethod();
         //then
-        assertThat(type.getMethod("foo").invoke(object), is((Object) "bar"));
+        Assertions.assertThat(type.getMethod("foo").invoke(object)).isEqualTo((Object) "bar");
         type.getMethod("foo").invoke(verify(object));
     }
 
@@ -103,7 +106,7 @@ public void shouldAllowSpyingOnDefaultMethod() throws Exception {
         Object object = spy(impl.newInstance());
 
         //when
-        assertThat(impl.getMethod("foo").invoke(object), is((Object) "bar"));
+        Assertions.assertThat(impl.getMethod("foo").invoke(object)).isEqualTo((Object) "bar");
         //then
         impl.getMethod("foo").invoke(verify(object));
     }
diff --git a/src/test/java/org/mockitousage/stacktrace/StackTraceFilteringTest.java b/src/test/java/org/mockitousage/stacktrace/StackTraceFilteringTest.java
index ee2cd2da85..7c925c0073 100644
--- a/src/test/java/org/mockitousage/stacktrace/StackTraceFilteringTest.java
+++ b/src/test/java/org/mockitousage/stacktrace/StackTraceFilteringTest.java
@@ -5,6 +5,7 @@
 
 package org.mockitousage.stacktrace;
 
+import org.assertj.core.api.Assertions;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -18,8 +19,12 @@
 import org.mockitoutil.TestBase;
 
 import static junit.framework.TestCase.fail;
-import static org.mockito.Mockito.*;
-import static org.mockitoutil.ExtraMatchers.hasFirstMethodInStackTrace;
+import static org.mockito.Mockito.inOrder;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+import static org.mockito.Mockito.verifyZeroInteractions;
+import static org.mockito.Mockito.when;
+import static org.mockitoutil.Conditions.firstMethodInStackTrace;
 
 public class StackTraceFilteringTest extends TestBase {
     
@@ -41,7 +46,7 @@ public void shouldFilterStackTraceOnVerify() {
             verify(mock).simpleMethod();
             fail();
         } catch (WantedButNotInvoked e) {
-            assertThat(e, hasFirstMethodInStackTrace("shouldFilterStackTraceOnVerify"));
+            Assertions.assertThat(e).has(firstMethodInStackTrace("shouldFilterStackTraceOnVerify"));
         }
     }
     
@@ -52,7 +57,7 @@ public void shouldFilterStackTraceOnVerifyNoMoreInteractions() {
             verifyNoMoreInteractions(mock);
             fail();
         } catch (NoInteractionsWanted e) {
-            assertThat(e, hasFirstMethodInStackTrace("shouldFilterStackTraceOnVerifyNoMoreInteractions"));
+            Assertions.assertThat(e).has(firstMethodInStackTrace("shouldFilterStackTraceOnVerifyNoMoreInteractions"));
         }
     }
     
@@ -63,7 +68,7 @@ public void shouldFilterStackTraceOnVerifyZeroInteractions() {
             verifyZeroInteractions(mock);
             fail();
         } catch (NoInteractionsWanted e) {
-            assertThat(e, hasFirstMethodInStackTrace("shouldFilterStackTraceOnVerifyZeroInteractions"));
+            Assertions.assertThat(e).has(firstMethodInStackTrace("shouldFilterStackTraceOnVerifyZeroInteractions"));
         }
     }
     
@@ -74,7 +79,7 @@ public void shouldFilterStacktraceOnMockitoException() {
             verify(mock).oneArg(true); 
             fail();
         } catch (MockitoException expected) {
-            assertThat(expected, hasFirstMethodInStackTrace("shouldFilterStacktraceOnMockitoException"));
+            Assertions.assertThat(expected).has(firstMethodInStackTrace("shouldFilterStacktraceOnMockitoException"));
         }
     }
     
@@ -89,7 +94,7 @@ public void shouldFilterStacktraceWhenVerifyingInOrder() {
             inOrder.verify(mock).oneArg(true);
             fail();
         } catch (VerificationInOrderFailure e) {
-            assertThat(e, hasFirstMethodInStackTrace("shouldFilterStacktraceWhenVerifyingInOrder"));
+            Assertions.assertThat(e).has(firstMethodInStackTrace("shouldFilterStacktraceWhenVerifyingInOrder"));
         }
     }
     
@@ -99,7 +104,7 @@ public void shouldFilterStacktraceWhenInOrderThrowsMockitoException() {
             inOrder();
             fail();
         } catch (MockitoException expected) {
-            assertThat(expected, hasFirstMethodInStackTrace("shouldFilterStacktraceWhenInOrderThrowsMockitoException"));
+            Assertions.assertThat(expected).has(firstMethodInStackTrace("shouldFilterStacktraceWhenInOrderThrowsMockitoException"));
         }
     }
     
@@ -110,7 +115,7 @@ public void shouldFilterStacktraceWhenInOrderVerifies() {
             inOrder.verify(null);
             fail();
         } catch (MockitoException expected) {
-            assertThat(expected, hasFirstMethodInStackTrace("shouldFilterStacktraceWhenInOrderVerifies"));
+            Assertions.assertThat(expected).has(firstMethodInStackTrace("shouldFilterStacktraceWhenInOrderVerifies"));
         }
     }
     
@@ -120,7 +125,7 @@ public void shouldFilterStackTraceWhenThrowingExceptionFromMockHandler() {
             when(mock.oneArg(true)).thenThrow(new Exception());
             fail();
         } catch (MockitoException expected) {
-            assertThat(expected, hasFirstMethodInStackTrace("shouldFilterStackTraceWhenThrowingExceptionFromMockHandler"));
+            Assertions.assertThat(expected).has(firstMethodInStackTrace("shouldFilterStackTraceWhenThrowingExceptionFromMockHandler"));
         }
     }
     
@@ -132,7 +137,7 @@ public void shouldShowProperExceptionStackTrace() throws Exception {
             mock.simpleMethod();
             fail();
         } catch (RuntimeException e) {
-            assertThat(e, hasFirstMethodInStackTrace("shouldShowProperExceptionStackTrace"));
+            Assertions.assertThat(e).has(firstMethodInStackTrace("shouldShowProperExceptionStackTrace"));
         }
     }
 }
diff --git a/src/test/java/org/mockitousage/verification/DescriptiveMessagesWhenVerificationFailsTest.java b/src/test/java/org/mockitousage/verification/DescriptiveMessagesWhenVerificationFailsTest.java
index 4a3a7ba7a2..d8e5bd157b 100644
--- a/src/test/java/org/mockitousage/verification/DescriptiveMessagesWhenVerificationFailsTest.java
+++ b/src/test/java/org/mockitousage/verification/DescriptiveMessagesWhenVerificationFailsTest.java
@@ -237,7 +237,7 @@ public void should_print_method_when_matcher_used() throws Exception {
                 "Wanted but not invoked:" +
                 "\n" +
                 "iMethods.twoArgumentMethod(\n" +
-                "    isA(java.lang.Integer),\n" +
+                "    <any integer>,\n" +
                 "    100\n" +
                 ");";
             assertContains(expectedMessage, actualMessage);
diff --git a/src/test/java/org/mockitousage/verification/PrintingVerboseTypesWithArgumentsTest.java b/src/test/java/org/mockitousage/verification/PrintingVerboseTypesWithArgumentsTest.java
index 5e6c8624f5..4149e8b5bc 100644
--- a/src/test/java/org/mockitousage/verification/PrintingVerboseTypesWithArgumentsTest.java
+++ b/src/test/java/org/mockitousage/verification/PrintingVerboseTypesWithArgumentsTest.java
@@ -5,13 +5,14 @@
 
 package org.mockitousage.verification;
 
+import org.assertj.core.api.Assertions;
 import org.junit.Test;
 import org.mockito.exceptions.verification.junit.ArgumentsAreDifferent;
 import org.mockitousage.IMethods;
 import org.mockitoutil.TestBase;
 
 import static junit.framework.TestCase.fail;
-import static org.mockito.Matchers.any;
+import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
@@ -21,17 +22,17 @@ public class PrintingVerboseTypesWithArgumentsTest extends TestBase {
     class Boo {
         public void withLong(long x) {
         }
-        
+
         public void withLongAndInt(long x, int y) {
         }
     }
-    
+
     @Test
-    public void shouldNotReportArgumentTypesWhenToStringIsTheSame() throws Exception {
+    public void should_not_report_argument_types_when_to_string_is_the_same() {
         //given
         Boo boo = mock(Boo.class);
         boo.withLong(100);
-        
+
         try {
             //when
             verify(boo).withLong(eq(100));
@@ -42,13 +43,13 @@ public void shouldNotReportArgumentTypesWhenToStringIsTheSame() throws Exception
             assertContains("withLong((Long) 100);", e.getMessage());
         }
     }
-    
+
     @Test
-    public void shouldShowTheTypeOfOnlyTheArgumentThatDoesntMatch() throws Exception {
+    public void should_show_the_type_of_only_the_argument_that_doesnt_match() {
         //given
         Boo boo = mock(Boo.class);
         boo.withLongAndInt(100, 200);
-        
+
         try {
             //when
             verify(boo).withLongAndInt(eq(100), eq(200));
@@ -59,30 +60,37 @@ public void shouldShowTheTypeOfOnlyTheArgumentThatDoesntMatch() throws Exception
             assertContains("withLongAndInt((Long) 100, 200)", e.getMessage());
         }
     }
-    
+
     @Test
-    public void shouldShowTheTypeOfTheMismatchingArgumentWhenOutputDescriptionsForInvocationsAreDifferent() throws Exception {
+    public void should_show_the_type_of_the_mismatching_argument_when_output_descriptions_for_invocations_are_different() {
         //given
         Boo boo = mock(Boo.class);
         boo.withLongAndInt(100, 200);
-        
+
         try {
             //when
             verify(boo).withLongAndInt(eq(100), any(Integer.class));
             fail();
         } catch (ArgumentsAreDifferent e) {
             //then
-            assertContains("withLongAndInt((Long) 100, 200)", e.getMessage());
-            assertContains("withLongAndInt((Integer) 100, <any>", e.getMessage());
+            Assertions.assertThat(e.getMessage())
+                      .contains("withLongAndInt(\n" +
+                                        "    (Long) 100,\n" +
+                                        "    200\n" +
+                                        ")")
+                      .contains("withLongAndInt(\n" +
+                                        "    (Integer) 100,\n" +
+                                        "    <any java.lang.Integer>\n" +
+                                        ")");
         }
     }
-    
+
     @Test
-    public void shouldNotShowTypesWhenArgumentValueIsDifferent() throws Exception {
+    public void should_not_show_types_when_argument_value_is_different() {
         //given
         Boo boo = mock(Boo.class);
         boo.withLongAndInt(100, 200);
-        
+
         try {
             //when
             verify(boo).withLongAndInt(eq(100L), eq(230));
@@ -93,34 +101,34 @@ public void shouldNotShowTypesWhenArgumentValueIsDifferent() throws Exception {
             assertContains("withLongAndInt(100, 230)", e.getMessage());
         }
     }
-    
+
     class Foo {
-        
+
         private final int x;
 
         public Foo(int x) {
             this.x = x;
         }
-        
+
         public boolean equals(Object obj) {
             return x == ((Foo) obj).x;
         }
-        
+
         public int hashCode() {
             return 1;
         }
-        
+
         public String toString() {
             return "foo";
         }
     }
-    
+
     @Test
-    public void shouldNotShowTypesWhenTypesAreTheSameEvenIfToStringGivesTheSameResult() throws Exception {
+    public void should_not_show_types_when_types_are_the_same_even_if_to_string_gives_the_same_result() {
         //given
         IMethods mock = mock(IMethods.class);
         mock.simpleMethod(new Foo(10));
-        
+
         try {
             //when
             verify(mock).simpleMethod(new Foo(20));
diff --git a/src/test/java/org/mockitoutil/Conditions.java b/src/test/java/org/mockitoutil/Conditions.java
new file mode 100644
index 0000000000..39061cd080
--- /dev/null
+++ b/src/test/java/org/mockitoutil/Conditions.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2007 Mockito contributors
+ * This program is made available under the terms of the MIT License.
+ */
+
+package org.mockitoutil;
+
+import org.assertj.core.api.Assertions;
+import org.assertj.core.api.Condition;
+import org.assertj.core.description.Description;
+import org.assertj.core.description.TextDescription;
+import org.hamcrest.CoreMatchers;
+
+import java.lang.reflect.Method;
+import java.util.Arrays;
+
+@SuppressWarnings("unchecked")
+public class Conditions {
+
+    public static Condition<Throwable> onlyThoseClassesInStackTrace(final String... classes) {
+        return new Condition<Throwable>() {
+            @Override
+            public boolean matches(Throwable traceElements) {
+                StackTraceElement[] trace = traceElements.getStackTrace();
+
+                Assertions.assertThat(trace.length)
+                          .describedAs("Number of classes does not match.\nExpected: %s\nGot: %s",
+                                       Arrays.toString(classes),
+                                       Arrays.toString(traceElements.getStackTrace()))
+                          .isEqualTo(classes.length);
+
+                for (int i = 0; i < trace.length; i++) {
+                    Assertions.assertThat(trace[i].getClassName()).isEqualTo(classes[i]);
+                }
+
+                return true;
+            }
+        };
+    }
+
+    public static Condition<StackTraceElement[]> onlyThoseClasses(final String... classes) {
+        return new Condition<StackTraceElement[]>() {
+
+            @Override
+            public boolean matches(StackTraceElement[] traceElements) {
+                Assertions.assertThat(traceElements.length)
+                          .describedAs("Number of classes does not match.\nExpected: %s\nGot: %s",
+                                       Arrays.toString(classes),
+                                       Arrays.toString(traceElements))
+                          .isEqualTo(classes.length);
+
+                for (int i = 0; i < traceElements.length; i++) {
+                    Assertions.assertThat(traceElements[i].getClassName()).isEqualTo(classes[i]);
+                }
+
+                return true;
+            }
+        };
+    }
+
+    public static Condition<Throwable> firstMethodInStackTrace(final String method) {
+        return methodInStackTraceAt(0, method);
+    }
+
+    public static Condition<Throwable> methodInStackTraceAt(final int stackTraceIndex, final String method) {
+        return new Condition<Throwable>() {
+            private String actualMethodAtIndex;
+
+            @Override
+            public boolean matches(Throwable throwable) {
+                actualMethodAtIndex = throwable.getStackTrace()[stackTraceIndex].getMethodName();
+
+                return actualMethodAtIndex.equals(method);
+            }
+
+            @Override
+            public Description description() {
+                return new TextDescription("Method at index: %d\nexpected to be: %s\nbut is: %s", stackTraceIndex, method, actualMethodAtIndex);
+            }
+        };
+    }
+
+    public static Condition<Object> bridgeMethod(final String methodName) {
+        return new Condition<Object>() {
+
+            public boolean matches(Object o) {
+                Class<?> clazz = null;
+                if (o instanceof Class) {
+                    clazz = (Class<?>) o;
+                } else {
+                    clazz = o.getClass();
+                }
+
+                for (Method m : clazz.getMethods()) {
+                    if (m.isBridge() && m.getName().equals(methodName)) {
+                        return true;
+                    }
+                }
+
+                Assertions.fail("Bridge method [" + methodName + "]\nnot found in:\n" + o);
+                return false;
+            }
+        };
+    }
+
+    public static org.hamcrest.Matcher<Object> clazz(Class<?> type) {
+        return CoreMatchers.instanceOf(type);
+    }
+
+    public static Condition<Throwable> methodsInStackTrace(final String... methods) {
+        return new Condition<Throwable>() {
+            public boolean matches(Throwable value) {
+                StackTraceElement[] trace = value.getStackTrace();
+                for (int i = 0; i < methods.length; i++) {
+                    Assertions.assertThat(trace[i].getMethodName()).describedAs("Expected methods[%d] to be in the stack trace.", i).isEqualTo(methods[i]);
+                }
+                return true;
+            }
+        };
+    }
+
+
+}
\ No newline at end of file
diff --git a/src/test/java/org/mockitoutil/ExtraMatchers.java b/src/test/java/org/mockitoutil/ExtraMatchers.java
deleted file mode 100644
index c3f80f34c6..0000000000
--- a/src/test/java/org/mockitoutil/ExtraMatchers.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright (c) 2007 Mockito contributors
- * This program is made available under the terms of the MIT License.
- */
-
-package org.mockitoutil;
-
-import org.hamcrest.CoreMatchers;
-import org.hamcrest.Matcher;
-
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-import static org.junit.Assert.*;
-
-@SuppressWarnings("unchecked")
-public class ExtraMatchers {
-
-    public static <T> Assertor<Throwable> hasFirstMethodInStackTrace(final String method) {
-        return hasMethodInStackTraceAt(0, method);
-    }
-    
-    public static <T> Assertor<Throwable> hasOnlyThoseClassesInStackTrace(final String ... classes) {
-        return new Assertor<Throwable>() {
-            public void assertValue(Throwable traceElements) {
-                StackTraceElement[] trace = traceElements.getStackTrace();
-                
-                assertEquals("Number of classes does not match." +
-                        "\nExpected: " + Arrays.toString(classes) + 
-                        "\nGot: " + Arrays.toString(traceElements.getStackTrace()),
-                        classes.length, trace.length);
-                    
-                for (int i = 0; i < trace.length; i++) {
-                    assertEquals(classes[i], trace[i].getClassName());
-                }
-            }
-        };
-    }
-    
-    public static <T> Assertor<StackTraceElement[]> hasOnlyThoseClasses(final String ... classes) {
-        return new Assertor<StackTraceElement[]>() {
-            public void assertValue(StackTraceElement[] traceElements) {
-                assertEquals("Number of classes does not match." +
-                        "\nExpected: " + Arrays.toString(classes) + 
-                        "\nGot: " + Arrays.toString(traceElements),
-                        classes.length, traceElements.length);
-                
-                for (int i = 0; i < traceElements.length; i++) {
-                    assertEquals(classes[i], traceElements[i].getClassName());
-                }
-            }
-        };
-    }
-    
-    public static <T> Assertor<Throwable> hasMethodInStackTraceAt(final int stackTraceIndex, final String method) {
-        return new Assertor<Throwable>() {
-
-            private String actualMethodAtIndex;
-
-            public void assertValue(Throwable throwable) {
-                actualMethodAtIndex = throwable.getStackTrace()[stackTraceIndex].getMethodName();
-                assertTrue(
-                    "Method at index: " + stackTraceIndex + 
-                    "\n" +
-                    "expected to be: " + method + 
-                    "\n" +
-                    "but is: " + actualMethodAtIndex,
-                    actualMethodAtIndex.equals(method));
-            }
-        };
-    }
-    
-    public static <T> Assertor<Object> hasBridgeMethod(final String methodName) {
-        return new Assertor<Object>() {
-
-            public void assertValue(Object o) {
-                Class<?> clazz = null;
-                if (o instanceof Class) {
-                    clazz = (Class<?>) o;
-                } else {
-                    clazz = o.getClass();
-                }
-                
-                for (Method m : clazz.getMethods()) {
-                    if (m.isBridge() && m.getName().equals(methodName)) {
-                        return;
-                    }
-                }
-                
-                fail("Bridge method [" + methodName + "]\nnot found in:\n" + o);
-            }
-        };
-    }
-    
-    public static <T> Assertor<Collection> hasExactlyInOrder(final T ... elements) {
-        return new Assertor<Collection>() {
-
-            public void assertValue(Collection value) {
-                assertEquals(elements.length, value.size());
-                
-                boolean containsSublist = Collections.indexOfSubList((List<?>) value, Arrays.asList(elements)) != -1;
-                assertTrue(
-                        "Elements:" +
-                        "\n" + 
-                        Arrays.toString(elements) + 
-                        "\n" +
-                        "were not found in collection:" +
-                        "\n" +
-                        value, containsSublist);
-            }
-        };
-    }
-    
-    public static <T> Assertor<Collection> contains(final Matcher<T> ... elements) {
-        return new Assertor<Collection>() {
-            
-            public void assertValue(Collection value) {
-                int matched = 0;
-                for (Matcher<T> m : elements) {
-                    for (Object el : value) {
-                        if (m.matches(el)) {
-                            matched++;
-                            continue;
-                        }
-                    }
-                }
-                
-                assertEquals("At least one of the matchers failed to match any of the elements", elements.length, matched);
-            }
-        };
-    }
-    
-    public static org.hamcrest.Matcher<Object> clazz(Class<?> type) {
-        return CoreMatchers.instanceOf(type);
-    }
-
-    public static Assertor<Throwable> hasMethodsInStackTrace(final String ... methods) {
-        return new Assertor<Throwable>() {
-            public void assertValue(Throwable value) {
-                StackTraceElement[] trace = value.getStackTrace();
-                for (int i = 0; i < methods.length; i++) {
-                    assertEquals("Expected methods[" + i + "] to be in the stack trace.", methods[i], trace[i].getMethodName());
-                }
-            }
-        };
-    }
-}
\ No newline at end of file
diff --git a/src/test/java/org/mockitoutil/JUnitResultAssert.java b/src/test/java/org/mockitoutil/JUnitResultAssert.java
index f4fd9f9769..8a425a91c6 100644
--- a/src/test/java/org/mockitoutil/JUnitResultAssert.java
+++ b/src/test/java/org/mockitoutil/JUnitResultAssert.java
@@ -2,7 +2,6 @@
 
 import org.junit.runner.Result;
 import org.junit.runner.notification.Failure;
-import org.mockito.exceptions.misusing.UnnecessaryStubbingException;
 
 import java.util.List;
 
@@ -57,4 +56,11 @@ private static String formatFailures(List<Failure> failures) {
         }
         return out.toString();
     }
+
+    /**
+     * Clean assertions for JUnit's result object
+     */
+    public static JUnitResultAssert assertThat(Result result) {
+        return new JUnitResultAssert(result);
+    }
 }
diff --git a/src/test/java/org/mockitoutil/TestBase.java b/src/test/java/org/mockitoutil/TestBase.java
index 9ad32341bd..348e12f060 100644
--- a/src/test/java/org/mockitoutil/TestBase.java
+++ b/src/test/java/org/mockitoutil/TestBase.java
@@ -5,10 +5,8 @@
 
 package org.mockitoutil;
 
-import org.hamcrest.Matcher;
 import org.junit.After;
 import org.junit.Before;
-import org.junit.runner.Result;
 import org.mockito.MockitoAnnotations;
 import org.mockito.StateMaster;
 import org.mockito.internal.MockitoCore;
@@ -26,7 +24,6 @@
 import java.io.IOException;
 import java.io.PrintStream;
 import java.util.Collection;
-import java.util.regex.Pattern;
 
 import static junit.framework.TestCase.assertFalse;
 import static junit.framework.TestCase.assertTrue;
@@ -68,29 +65,6 @@ protected Invocation getLastInvocation() {
         return new MockitoCore().getLastInvocation();
     }
 
-    //I'm really tired of matchers, enter the assertor!
-    protected static <T> void assertThat(T o, Assertor<T> a) {
-        a.assertValue(o);
-    }
-
-    protected static <T> void assertThat(T actual, Matcher<? super T> matcher) {
-        org.junit.Assert.assertThat(actual, matcher);
-    }
-    
-    protected static <T> void assertThat(String message, T actual, Matcher<T> m) {
-        org.junit.Assert.assertThat(message, actual, m);
-    }
-    
-    public static <T> Assertor<String> endsWith(final String substring) {
-        return new Assertor<String>() {
-            public void assertValue(String value) {
-                assertTrue("This substring: \n" + substring + 
-                        "\nshould be at the end of:\n" + value
-                        , value.endsWith(substring));
-            }
-        };
-    }
-    
     public static void assertNotEquals(Object expected, Object got) {
         assertFalse(expected.equals(got));
     }
@@ -201,11 +175,4 @@ protected String getStackTrace(Throwable e) {
     protected String filterLineNo(String stackTrace) {
         return stackTrace.replaceAll("(\\((\\w+\\.java):(\\d)+\\))", "($2:0)");
     }
-
-    /**
-     * Clean assertions for JUnit's result object
-     */
-    protected JUnitResultAssert assertThat(Result result) {
-        return new JUnitResultAssert(result);
-    }
 }