arashja / hamcrest

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

Matcher fails to compile : Checking that collection contains instance of a class #135

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I'd like to assert that List<Achievement> contains a member of type 
TestAchievement.

Here's my assertion:

List<Achievement> achievements; // Populated elsewhere
assertThat(achievements,hasItem(isA(TestAchievement.class)));

This doesn't compile, reporting the error:

The method assertThat(T, Matcher) in the type Assert is not applicable for the 
arguments (List, Matcher>)

Using Hamcrest 1.1

Please see discussion here:
http://stackoverflow.com/questions/4981586/java-hamcrest-collection-contains-ite
m-of-type

Original issue reported on code.google.com by martypit...@gtempaccount.com on 13 Feb 2011 at 3:09

GoogleCodeExporter commented 8 years ago
Apologies - updated to 1.3RC2 and the issue is resolved.

Original comment by martypit...@gtempaccount.com on 13 Feb 2011 at 3:19

GoogleCodeExporter commented 8 years ago

Original comment by smgfree...@gmail.com on 25 Apr 2012 at 11:28