How do I remove the warning from a EasyMock.anyObject(List.class) call

Viewed 15426

Compiler can't stop complaining with this call :

EasyMock.anyObject(List.class) 

I tried to specify list's type

EasyMock.anyObject(List<MyType>.class)

but it doesn't seems to be an option (anyway, it is stupid since java will erase the type during the compilation)

Is there a clean way (@SuppressWarning is not a clean way IMO) to remove this warning?

Thank you

3 Answers

You can also try to use the Hamcrest matcher isA(), instead of anyObject(). The difference between them is that isA-matcher checks the values on null, unlike anyObject. You can learn more about those matchers here

Related