Mockito.any() pass Interface with Generics

前端 未结 7 1297
我在风中等你
我在风中等你 2020-11-29 16:26

is it possible to pass the type of an interface with generics?

The interface:

public interface AsyncCallback

In my test me

7条回答
  •  旧巷少年郎
    2020-11-29 17:21

    Using Java 8, you can simply use any() (assuming static import) without argument or type parameter because of enhanced type inference. The compiler now knows from the target type (the type of the method argument) that you actually mean Matchers.>any(), which is the pre-Java 8 solution.

提交回复
热议问题