jocarreira / hamcrest

Automatically exported from code.google.com/p/hamcrest
0 stars 0 forks source link

Untyped instanceOf breaks jMock parameter matching #29

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The matching of parameter as being an instance of a type using jMock is 
currently broken due to “instanceOf” being typed with Object instead of T.

The jMock Cookbook example below will only work if the 
method "doSomething" has a signature of void doSomething(Object).

one(mock).doSomething(with(instanceOf(ActionEvent.class)));

The workaround for this issue is to cast the results of “with” 
or “instanceOf”.

See the relaxing of types in issue 10.

Original issue reported on code.google.com by de...@kimotaprime.com on 22 Jan 2008 at 11:56

GoogleCodeExporter commented 8 years ago
I think InstanceOf should have type Matcher<? super T>.

Original comment by nat.pr...@gmail.com on 16 Oct 2008 at 12:12

GoogleCodeExporter commented 8 years ago
fixed (I think)

Original comment by smgfree...@gmail.com on 20 Nov 2008 at 7:13

GoogleCodeExporter commented 8 years ago
Issue reopened, see http://code.google.com/p/hamcrest/issues/detail?id=52

Original comment by smgfree...@gmail.com on 22 Nov 2008 at 12:19