Hey,
How I can match the Class
, I want pass the method.
class A (){ public B method(Class T,String str){} }
when I invoice the Mockmethod,the method don't pass.
A a = new A(); B b = new B(); when(a.method(any<Class>).thenReturn(b);
use any(CLass.class) is ok.
Using any(Class.class) gives you the following warning by the compiler: Unchecked assignment: 'java.lang.Class' to 'java.lang.Class<java.lang.Object>'.
You can use this syntax instead:
ArgumentMatchers.<Class<A>>any()
Most helpful comment
Using
any(Class.class)gives you the following warning by the compiler:Unchecked assignment: 'java.lang.Class' to 'java.lang.Class<java.lang.Object>'.You can use this syntax instead:
ArgumentMatchers.<Class<A>>any()